Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Fully functional

File size: 3.3 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 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);
52        model_ = NULL;
53        cs_ = NULL;
54    }
55
56    HoverWall::HoverWall(Context* context, int x, int y, int orientation) : StaticEntity(context)
57    {
58        RegisterObject(HoverWall);
59
60        int xSize_, zSize_, xPos_, zPos_;
61
62        if(orientation == 1){
63            xSize_ = 50;
64            zSize_ = 2;
65            zPos_ = x*100;
66            xPos_ = y*100 -50;
67        }
68        else{
69            xSize_ = 2;
70            zSize_ = 50;
71            zPos_ = x*100-50;
72            xPos_ = y*100;
73        }
74
75
76        model_ = new Model(context);
77        model_->setMeshSource("CuboidBody.mesh");
78        model_->setScale3D(Vector3(xSize_, 30, zSize_));
79        model_->setPosition(Vector3(xPos_,0,zPos_));
80
81        this->attach(model_);
82
83        this->enableCollisionCallback();
84        this->setCollisionResponse(true);
85        this->setCollisionType(Static);
86
87        cs_ = new BoxCollisionShape(context);
88        cs_->setHalfExtents(Vector3(xSize_, 30, zSize_));
89        cs_->setPosition(Vector3(xPos_,0,zPos_));
90
91        this->attachCollisionShape(cs_);
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.