Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10123 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
RevLine 
[9135]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
[9141]9/* Not implemented fully */
10
[9135]11#include "Tower.h"
12
13#include "core/CoreIncludes.h"
14//#include "core/XMLPort.h"
15
16namespace orxonox
17{
[9667]18    RegisterClass(Tower);
[9272]19
[9135]20    /**
[9272]21    @brief
22        Constructor. Registers and initializes the object.
23    */
[9667]24    Tower::Tower(Context* context) : Pawn(context)
[9135]25    {
26        RegisterObject(Tower);
[9175]27
28        this->setCollisionType(WorldEntity::Dynamic);
29
[9213]30        //this->removeAllEngines();
[9175]31
[9135]32        /*
33        this->size_ = 10.0f;
34        this->delay_ = false;
35        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
[9272]36        */
[9135]37    }
[9272]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.
[9143]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
[9135]76    /**
[9272]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    /*
[9135]83    void Tower::moveFrontBack(const Vector2& value)
84    {
[9161]85        //orxout() << "frontBack.x: " << value.x << endl;
[9135]86    }
[9272]87    */
88
[9135]89    /**
[9272]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    /*
[9135]96    void Tower::moveRightLeft(const Vector2& value)
97    {
[9272]98        //orxout() << "rightLeft.x: " << value.x << endl;
99
[9135]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;
[9272]106
[9135]107            this->setPosition(newPos);
108            this->delay_ = true;
109            this->delayTimer_.startTimer();
[9272]110        }
[9135]111    }
[9272]112    */
[9143]113}
Note: See TracBrowser for help on using the repository browser.