Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/newlevel2012/src/modules/towerdefense/Tower.cc @ 9204

Last change on this file since 9204 was 9175, checked in by weigeltm, 13 years ago

removed attach-command, got rid of error messages, attached weapons to towers

File size: 2.5 KB
Line 
1//
2//  Tower.cc
3//  Orxonox
4//
5//  Created by Fabian Mentzer on 29.04.12.
6//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
7//
8
9/* Not implemented fully */
10
11#include "Tower.h"
12
13#include "core/CoreIncludes.h"
14//#include "core/XMLPort.h"
15
16namespace orxonox
17{
18    CreateFactory(Tower);
19       
20    /**
21         @brief
22         Constructor. Registers and initializes the object.
23         */
24    Tower::Tower(BaseObject* creator) : SpaceShip(creator)
25    {
26        RegisterObject(Tower);
27
28        this->setCollisionType(WorldEntity::Dynamic);
29
30
31
32        /*
33        this->size_ = 10.0f;
34        this->delay_ = false;
35        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
36                */
37    }
38        // This function is called whenever a player presses the up or the down key.
39    // You have to implement what happens when the up or the down key is pressed.
40    // value.x < 0 means: down key is pressed.
41    // I suggest to create a new class which is a controllable entity I will refer to as "TowerMover". This is the controllable entity that the
42    // player controls in order to move the tower along the centerpoint and in order to place the tower at the appropriate position.
43    //
44
45    // The tower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
46    //(don't forget to set the team_ parameter such that all tower are in the same team)
47
48    //How to move a tower: simply attach the tower to the TowerMover
49    //How to place a tower: detach the tower from the TowerMover
50
51    /**
52         @brief
53         Overloaded the function to rotate the stone.
54         @param value
55         A vector whose first component is the angle by which to rotate.
56         */
57    void Tower::moveFrontBack(const Vector2& value)
58    {
59        //orxout() << "frontBack.x: " << value.x << endl;
60    }
61       
62    /**
63         @brief
64         Overloaded the function to steer the stone right and left
65         @param value
66         A vector whose first component is the direction in which we want to steer the stone.
67         */
68    void Tower::moveRightLeft(const Vector2& value)
69    {
70                //orxout() << "rightLeft.x: " << value.x << endl;
71                /*
72        if(!this->delay_)
73        {
74            const Vector3& position = this->getPosition();
75            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
76            if(!this->tetris_->isValidMove(this, newPos))
77                return;
78                       
79            this->setPosition(newPos);
80            this->delay_ = true;
81            this->delayTimer_.startTimer();
82        }
83                 */
84    }
85}
Note: See TracBrowser for help on using the repository browser.