Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9161 was 9161, checked in by weigeltm, 12 years ago

updated tower template and more stuff

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) : ControllableEntity(creator)
25    {
26        RegisterObject(Tower);
27        /*
28        this->size_ = 10.0f;
29        this->delay_ = false;
30        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
31                */
32    }
33        // This function is called whenever a player presses the up or the down key.
34    // You have to implement what happens when the up or the down key is pressed.
35    // value.x < 0 means: down key is pressed.
36    // 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
37    // player controls in order to move the tower along the centerpoint and in order to place the tower at the appropriate position.
38    //
39
40    // The tower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
41    //(don't forget to set the team_ parameter such that all tower are in the same team)
42
43    //How to move a tower: simply attach the tower to the TowerMover
44    //How to place a tower: detach the tower from the TowerMover
45
46    /**
47         @brief
48         Overloaded the function to rotate the stone.
49         @param value
50         A vector whose first component is the angle by which to rotate.
51         */
52    void Tower::moveFrontBack(const Vector2& value)
53    {
54        //orxout() << "frontBack.x: " << value.x << endl;
55    }
56       
57    /**
58         @brief
59         Overloaded the function to steer the stone right and left
60         @param value
61         A vector whose first component is the direction in which we want to steer the stone.
62         */
63    void Tower::moveRightLeft(const Vector2& value)
64    {
65                //orxout() << "rightLeft.x: " << value.x << endl;
66                /*
67        if(!this->delay_)
68        {
69            const Vector3& position = this->getPosition();
70            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
71            if(!this->tetris_->isValidMove(this, newPos))
72                return;
73                       
74            this->setPosition(newPos);
75            this->delay_ = true;
76            this->delayTimer_.startTimer();
77        }
78                 */
79    }
80}
Note: See TracBrowser for help on using the repository browser.