Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10283 was 10258, checked in by landauf, 10 years ago

merged presentationHS14merge back to trunk

  • Property svn:eol-style set to native
File size: 3.8 KB
RevLine 
[10142]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) : Pawn(context)
25    {
26        RegisterObject(TowerDefenseTower);
27
28        this->setCollisionType(WorldEntity::Dynamic);
[10158]29        upgrade = 0;
[10142]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    void TowerDefenseTower::setOrientation(const Quaternion& orientation)
41    {
42    }
43
44    void TowerDefenseTower::rotateYaw(const Vector2& value)
45    {
46    }
47
48    void TowerDefenseTower::rotatePitch(const Vector2& value)
49    {
50    }
51
52    void TowerDefenseTower::rotateRoll(const Vector2& value)
53    {
54    }
55
[10158]56    bool TowerDefenseTower::upgradeTower()
[10246]57    {
58        if(upgrade < 3)
59        {
60            upgrade++;
61            float reloadrate = getReloadRate();
62            float reloadwaittime = getReloadWaitTime();
63            this->setDamageMultiplier(5000);
[10158]64
[10246]65            reloadrate = 0.5f*reloadrate;
66            reloadwaittime = 0.5f*reloadwaittime;
67            setReloadRate(reloadrate);
68            setReloadWaitTime(reloadwaittime);
69            this->addTemplate("towerturret1");
70        }
71        else
72        {
73            orxout() << "Tower fully upgraded" << endl;
74            return false;
75        }
76        return true;
77    }
[10158]78
[10142]79    // This function is called whenever a player presses the up or the down key.
80    // You have to implement what happens when the up or the down key is pressed.
81    // value.x < 0 means: down key is pressed.
82    // 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
83    // player controls in order to move the TowerDefenseTower along the centerpoint and in order to place the TowerDefenseTower at the appropriate position.
84    //
85
86    // The TowerDefenseTower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
87    //(don't forget to set the team_ parameter such that all TowerDefenseTower are in the same team)
88
89    //How to move a TowerDefenseTower: simply attach the TowerDefenseTower to the TowerDefenseTowerMover
90    //How to place a TowerDefenseTower: detach the TowerDefenseTower from the TowerDefenseTowerMover
91
92    /**
93    @brief
94        Overloaded the function to rotate the stone.
95    @param value
96        A vector whose first component is the angle by which to rotate.
97    */
98    /*
99    void TowerDefenseTower::moveFrontBack(const Vector2& value)
100    {
101        //orxout() << "frontBack.x: " << value.x << endl;
102    }
103    */
104
105    /**
106    @brief
107        Overloaded the function to steer the stone right and left
108    @param value
109        A vector whose first component is the direction in which we want to steer the stone.
110    */
111    /*
112    void TowerDefenseTower::moveRightLeft(const Vector2& value)
113    {
114        //orxout() << "rightLeft.x: " << value.x << endl;
115
116        if(!this->delay_)
117        {
118            const Vector3& position = this->getPosition();
119            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
120            if(!this->tetris_->isValidMove(this, newPos))
121                return;
122
123            this->setPosition(newPos);
124            this->delay_ = true;
125            this->delayTimer_.startTimer();
126        }
127    }
128    */
129}
Note: See TracBrowser for help on using the repository browser.