Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FlappyOrx_HS17/src/modules/towerdefense/TowerDefenseTower.cc @ 11530

Last change on this file since 11530 was 11071, checked in by landauf, 9 years ago

merged branch cpp11_v3 back to trunk

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