Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentationHS15/src/modules/hover/HoverWall.cc @ 11026

Last change on this file since 11026 was 11026, checked in by landauf, 8 years ago

eol-style:native

  • Property svn:eol-style set to native
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:
[10930]23 *      Manuel Meier
[10751]24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file HoverWall.cc
[10930]31    @brief Represents one Wall piece in the Hover Game
[10751]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
[10930]56
57    /**
58    @brief
59        Constructor of a HoverWall
60    @param x
61        x-Coordinate of the Square that the Wall is attached to, 0-9, Origin is Bottom left
62    @param y
63        y-Coordinate of the Square that the Wall is attached to, 0-9, Origin is Bottom left
64    @param orientation
65            Wall on the right side (1) or on top (2) of this square, 0-1       
66    */
[10785]67    HoverWall::HoverWall(Context* context, int x, int y, int orientation) : StaticEntity(context)
[10751]68    {
69        RegisterObject(HoverWall);
[10760]70
[10785]71        int xSize_, zSize_, xPos_, zPos_;
72
73        if(orientation == 1){
74            xSize_ = 50;
75            zSize_ = 2;
[10787]76            zPos_ = x*100;
77            xPos_ = y*100 -50;
[10785]78        }
79        else{
80            xSize_ = 2;
81            zSize_ = 50;
[10787]82            zPos_ = x*100-50;
83            xPos_ = y*100;
[10785]84        }
85
86
[10751]87        model_ = new Model(context);
[10926]88        model_->setMeshSource("CuboidBody.mesh");
[10785]89        model_->setScale3D(Vector3(xSize_, 30, zSize_));
90        model_->setPosition(Vector3(xPos_,0,zPos_));
[10751]91
[10760]92        this->attach(model_);
[10751]93
[10760]94        this->enableCollisionCallback();
95        this->setCollisionResponse(true);
96        this->setCollisionType(Static);
[10751]97
[10760]98        cs_ = new BoxCollisionShape(context);
[10785]99        cs_->setHalfExtents(Vector3(xSize_, 30, zSize_));
100        cs_->setPosition(Vector3(xPos_,0,zPos_));
[10760]101
102        this->attachCollisionShape(cs_);
[10751]103    }
104
105    /**
106    @brief
107        Destructor.
108    */
109    HoverWall::~HoverWall()
110    {
111
112    }
113
[10930]114    //xml port for loading height and width of the platform, unused
[10751]115    void HoverWall::XMLPort(Element& xmlelement, XMLPort::Mode mode)
116    {
117        SUPER(HoverWall, XMLPort, xmlelement, mode);
118    }
119
120    /**
121    @brief
122        Is called every tick.
123        Handles the movement of the ball and its interaction with the boundaries and bats.
124    @param dt
125        The time since the last tick.
126    */
127    void HoverWall::tick(float dt)
128    {
129        SUPER(HoverWall, tick, dt);
130       
131    }
132
133   
134}
Note: See TracBrowser for help on using the repository browser.