Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/towerdefense/TowerDefenseTower.cc @ 10817

Last change on this file since 10817 was 10727, checked in by landauf, 9 years ago

fixed warnings with MSVC14

  • Property svn:eol-style set to native
File size: 3.9 KB
Line 
1//
2//  TowerDefenseTower.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 "TowerDefenseTower.h"
12
13#include "core/CoreIncludes.h"
14//#include "core/XMLPort.h"
15
16namespace orxonox
17{
18    RegisterClass(TowerDefenseTower);
19
20    /**
21    @brief
22        Constructor. Registers and initializes the object.
23    */
24    TowerDefenseTower::TowerDefenseTower(Context* context) : Turret(context)
25    {
26        RegisterObject(TowerDefenseTower);
27        game_ =NULL;
28        this->setCollisionType(WorldEntity::None);
29        upgrade = 1;
30
31        //this->removeAllEngines();
32
33        /*
34        this->size_ = 10.0f;
35        this->delay_ = false;
36        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
37        */
38    }
39
40    /*
41    void TowerDefenseTower::setOrientation(const Quaternion& orientation)
42    {
43    }
44
45    void TowerDefenseTower::rotateYaw(const Vector2& value)
46    {
47    }
48
49    void TowerDefenseTower::rotatePitch(const Vector2& value)
50    {
51    }
52
53    void TowerDefenseTower::rotateRoll(const Vector2& value)
54    {
55    }
56    */
57
58    bool TowerDefenseTower::upgradeTower()
59    {
60        if(upgrade < 5)
61        {
62            upgrade++;
63            float reloadrate = getReloadRate();
64            float reloadwaittime = getReloadWaitTime();
65            this->setDamageMultiplier((upgrade+1)*2.0f);
66            //this->setRotationThrust(2*this->getRotationThrust());
67            reloadrate = 0.5f*reloadrate;
68            reloadwaittime = 0.5f*reloadwaittime;
69            setReloadRate(reloadrate);
70            setReloadWaitTime(reloadwaittime);
71            //this->addTemplate("towerturret1");
72        }
73        else
74        {
75            orxout() << "Tower fully upgraded" << endl;
76            return false;
77        }
78        return true;
79    }
80
81    // This function is called whenever a player presses the up or the down key.
82    // You have to implement what happens when the up or the down key is pressed.
83    // value.x < 0 means: down key is pressed.
84    // I suggest to create a new class which is a controllable entity I will refer to as "TowerDefenseTowerMover". This is the controllable entity that the
85    // player controls in order to move the TowerDefenseTower along the centerpoint and in order to place the TowerDefenseTower at the appropriate position.
86    //
87
88    // The TowerDefenseTower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
89    //(don't forget to set the team_ parameter such that all TowerDefenseTower are in the same team)
90
91    //How to move a TowerDefenseTower: simply attach the TowerDefenseTower to the TowerDefenseTowerMover
92    //How to place a TowerDefenseTower: detach the TowerDefenseTower from the TowerDefenseTowerMover
93
94    /**
95    @brief
96        Overloaded the function to rotate the stone.
97    @param value
98        A vector whose first component is the angle by which to rotate.
99    */
100    /*
101    void TowerDefenseTower::moveFrontBack(const Vector2& value)
102    {
103        //orxout() << "frontBack.x: " << value.x << endl;
104    }
105    */
106
107    /**
108    @brief
109        Overloaded the function to steer the stone right and left
110    @param value
111        A vector whose first component is the direction in which we want to steer the stone.
112    */
113    /*
114    void TowerDefenseTower::moveRightLeft(const Vector2& value)
115    {
116        //orxout() << "rightLeft.x: " << value.x << endl;
117
118        if(!this->delay_)
119        {
120            const Vector3& position = this->getPosition();
121            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
122            if(!this->tetris_->isValidMove(this, newPos))
123                return;
124
125            this->setPosition(newPos);
126            this->delay_ = true;
127            this->delayTimer_.startTimer();
128        }
129    }
130    */
131}
Note: See TracBrowser for help on using the repository browser.