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