Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/hoverHS15/src/modules/hover/HoverFlag.cc @ 10928

Last change on this file since 10928 was 10928, checked in by meierman, 8 years ago

Before finishing touch

File size: 3.4 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabien Vultier
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file HoverFlag.cc
31    @brief All platforms in this minigame inherit from this class. The basic functions of a platform (interact with figure) is implemented here. Special functions are implemented in the specialized classes.
32*/
33
34#include "HoverFlag.h"
35#include "HoverShip.h"
36
37#include "core/CoreIncludes.h"
38#include "core/GameMode.h"
39#include "graphics/Model.h"
40#include "gametypes/Gametype.h"
41
42
43
44
45#include "core/XMLPort.h"
46
47namespace orxonox
48{
49    RegisterClass(HoverFlag);
50
51    HoverFlag::HoverFlag(Context* context) : StaticEntity(context)
52    {
53        RegisterObject(HoverFlag);
54        model_ = NULL;
55        cs_ = NULL;
56    }
57
58    HoverFlag::HoverFlag(Context* context, int xCoordinate, int yCoordinate) : StaticEntity(context)
59    {
60        RegisterObject(HoverFlag);
61        enableCollisionCallback();
62        model_ = NULL;
63        cs_ = NULL;
64
65        model_ = new Model(context);
66        model_->setMeshSource("ss_flag_eu.mesh");
67        model_->setScale3D(Vector3(5, 5, 5));
68        model_->setPosition(Vector3(xCoordinate*100 + 50,10,yCoordinate*100 + 50));
69
70        this->attach(model_);
71
72        this->enableCollisionCallback();
73        this->setCollisionResponse(true);
74        this->setCollisionType(Static);
75
76        cs_ = new BoxCollisionShape(context);
77        cs_->setHalfExtents(Vector3(5, 5, 5));
78        cs_->setPosition(Vector3(xCoordinate*100 + 50,0,yCoordinate*100 + 50));
79
80        this->attachCollisionShape(cs_);
81        this->collided_ = false;
82
83    }
84
85    /**
86    @brief
87        Destructor.
88    */
89    HoverFlag::~HoverFlag()
90    {
91
92    }
93
94    //xml port for loading height and width of the platform
95    void HoverFlag::XMLPort(Element& xmlelement, XMLPort::Mode mode)
96    {
97        SUPER(HoverFlag, XMLPort, xmlelement, mode);
98    }
99
100
101
102
103    /**
104    @brief
105        Is called every tick.
106        Handles the movement of the ball and its interaction with the boundaries and bats.
107    @param dt
108        The time since the last tick.
109    */
110    void HoverFlag::tick(float dt)
111    {
112        SUPER(HoverFlag, tick, dt);
113       
114    }
115
116    bool HoverFlag::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
117    {
118        if(otherObject->isA(Class(HoverShip)))
119            collided_ = true;
120        return false;
121    }
122
123    bool HoverFlag::getCollided(){
124        return collided_;
125    }
126
127    void HoverFlag::setCollided(bool setValue){
128        collided_ = setValue;
129    }
130   
131   
132}
Note: See TracBrowser for help on using the repository browser.