Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/towerdefense/Tower.cc @ 9837

Last change on this file since 9837 was 9667, checked in by landauf, 11 years ago

merged core6 back to trunk

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