Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentationHS15/src/modules/hover/HoverFlag.cc @ 11030

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

fixed some compiler warnings (MSVC)

  • Property svn:eol-style set to native
File size: 3.3 KB
RevLine 
[10894]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:
[10930]23 *      Manuel Meier
[10894]24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file HoverFlag.cc
[10930]31    @brief The Flags that are being set in the Hover Minigame They support two coordinates from 0-9 each
[10894]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
[10930]58    /**
59    @brief
60        Constructor that expects two coordinate-values in the range 0-9
61    @param xCoordinate
62        X-Coordinate of the flage, 0-9, origin is bottom left
63    @param yCoordinate
64        Y-Coordinate of the flage, 0-9, origin is bottom left
65    */
[10894]66    HoverFlag::HoverFlag(Context* context, int xCoordinate, int yCoordinate) : StaticEntity(context)
67    {
68        RegisterObject(HoverFlag);
69        enableCollisionCallback();
70        model_ = NULL;
71        cs_ = NULL;
72
73        model_ = new Model(context);
74        model_->setMeshSource("ss_flag_eu.mesh");
75        model_->setScale3D(Vector3(5, 5, 5));
[11030]76        model_->setPosition(Vector3(xCoordinate*100.0f + 50.0f,10.0f,yCoordinate*100.0f + 50.0f));
[10894]77
78        this->attach(model_);
79
80        this->enableCollisionCallback();
81        this->setCollisionResponse(true);
82        this->setCollisionType(Static);
83
84        cs_ = new BoxCollisionShape(context);
85        cs_->setHalfExtents(Vector3(5, 5, 5));
[11030]86        cs_->setPosition(Vector3(xCoordinate*100.0f + 50.0f,0.0f,yCoordinate*100.0f + 50.0f));
[10894]87
88        this->attachCollisionShape(cs_);
89        this->collided_ = false;
90
91    }
92
93    /**
94    @brief
95        Destructor.
96    */
97    HoverFlag::~HoverFlag()
98    {
99
100    }
101
[10930]102    //xml port unused
[10894]103    void HoverFlag::XMLPort(Element& xmlelement, XMLPort::Mode mode)
104    {
105        SUPER(HoverFlag, XMLPort, xmlelement, mode);
106    }
107
108    /**
109    @brief
[10930]110        Checks if the Hovership collided with the flag
111    */
[10894]112    bool HoverFlag::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
113    {
[10928]114        if(otherObject->isA(Class(HoverShip)))
[10894]115            collided_ = true;
116        return false;
117    }
118
119    bool HoverFlag::getCollided(){
120        return collided_;
121    }
122
123    void HoverFlag::setCollided(bool setValue){
124        collided_ = setValue;
125    }
126   
127   
128}
Note: See TracBrowser for help on using the repository browser.