Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/hoverHS15/src/modules/hover/HoverWall.cc @ 10819

Last change on this file since 10819 was 10787, checked in by meierman, 9 years ago

programm wall placement works

File size: 3.3 KB
RevLine 
[10751]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 HoverWall.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 "HoverWall.h"
35
36#include "core/CoreIncludes.h"
37#include "core/GameMode.h"
38#include "graphics/Model.h"
39#include "gametypes/Gametype.h"
40
41
42
43#include "core/XMLPort.h"
44
45namespace orxonox
46{
47    RegisterClass(HoverWall);
48
49    HoverWall::HoverWall(Context* context) : StaticEntity(context)
50    {
51        RegisterObject(HoverWall);
[10760]52        model_ = NULL;
53        cs_ = NULL;
[10751]54    }
55
[10785]56    HoverWall::HoverWall(Context* context, int x, int y, int orientation) : StaticEntity(context)
[10751]57    {
58        RegisterObject(HoverWall);
[10760]59
[10785]60        int xSize_, zSize_, xPos_, zPos_;
61
62        if(orientation == 1){
63            xSize_ = 50;
64            zSize_ = 2;
[10787]65            zPos_ = x*100;
66            xPos_ = y*100 -50;
[10785]67        }
68        else{
69            xSize_ = 2;
70            zSize_ = 50;
[10787]71            zPos_ = x*100-50;
72            xPos_ = y*100;
[10785]73        }
74
75
[10751]76        model_ = new Model(context);
77        model_->setMeshSource("cube.mesh");
[10785]78        model_->setScale3D(Vector3(xSize_, 30, zSize_));
79        model_->setPosition(Vector3(xPos_,0,zPos_));
[10751]80
[10760]81        this->attach(model_);
[10751]82
[10760]83        this->enableCollisionCallback();
84        this->setCollisionResponse(true);
85        this->setCollisionType(Static);
[10751]86
[10760]87        cs_ = new BoxCollisionShape(context);
[10785]88        cs_->setHalfExtents(Vector3(xSize_, 30, zSize_));
89        cs_->setPosition(Vector3(xPos_,0,zPos_));
[10760]90
91        this->attachCollisionShape(cs_);
[10751]92    }
93
94    /**
95    @brief
96        Destructor.
97    */
98    HoverWall::~HoverWall()
99    {
100
101    }
102
103    //xml port for loading height and width of the platform
104    void HoverWall::XMLPort(Element& xmlelement, XMLPort::Mode mode)
105    {
106        SUPER(HoverWall, XMLPort, xmlelement, mode);
107
108       // XMLPortParam(HoverWall, "height", setHeight, getHeight, xmlelement, mode);
109        //XMLPortParam(HoverWall, "width", setWidth, getWidth, xmlelement, mode);
110    }
111
112    /**
113    @brief
114        Is called every tick.
115        Handles the movement of the ball and its interaction with the boundaries and bats.
116    @param dt
117        The time since the last tick.
118    */
119    void HoverWall::tick(float dt)
120    {
121        SUPER(HoverWall, tick, dt);
122       
123    }
124
125   
126}
Note: See TracBrowser for help on using the repository browser.