Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/fabienHS15/src/modules/towerdefense/TowerDefenseTower.cc @ 10791

Last change on this file since 10791 was 10739, checked in by fvultier, 9 years ago

HUD improved. Corrected text rescaling. Renamed reload to shieldRecharge in Pawn.cc, … to avoid confusion with the weapon system.

  • Property svn:eol-style set to native
File size: 3.6 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            this->setDamageMultiplier((upgrade+1)*2);
64            //this->setRotationThrust(2*this->getRotationThrust());
65            //this->addTemplate("towerturret1");
66        }
67        else
68        {
69            orxout() << "Tower fully upgraded" << endl;
70            return false;
71        }
72        return true;
73    }
74
75    // This function is called whenever a player presses the up or the down key.
76    // You have to implement what happens when the up or the down key is pressed.
77    // value.x < 0 means: down key is pressed.
78    // 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
79    // player controls in order to move the TowerDefenseTower along the centerpoint and in order to place the TowerDefenseTower at the appropriate position.
80    //
81
82    // The TowerDefenseTower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
83    //(don't forget to set the team_ parameter such that all TowerDefenseTower are in the same team)
84
85    //How to move a TowerDefenseTower: simply attach the TowerDefenseTower to the TowerDefenseTowerMover
86    //How to place a TowerDefenseTower: detach the TowerDefenseTower from the TowerDefenseTowerMover
87
88    /**
89    @brief
90        Overloaded the function to rotate the stone.
91    @param value
92        A vector whose first component is the angle by which to rotate.
93    */
94    /*
95    void TowerDefenseTower::moveFrontBack(const Vector2& value)
96    {
97        //orxout() << "frontBack.x: " << value.x << endl;
98    }
99    */
100
101    /**
102    @brief
103        Overloaded the function to steer the stone right and left
104    @param value
105        A vector whose first component is the direction in which we want to steer the stone.
106    */
107    /*
108    void TowerDefenseTower::moveRightLeft(const Vector2& value)
109    {
110        //orxout() << "rightLeft.x: " << value.x << endl;
111
112        if(!this->delay_)
113        {
114            const Vector3& position = this->getPosition();
115            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
116            if(!this->tetris_->isValidMove(this, newPos))
117                return;
118
119            this->setPosition(newPos);
120            this->delay_ = true;
121            this->delayTimer_.startTimer();
122        }
123    }
124    */
125}
Note: See TracBrowser for help on using the repository browser.