Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickupsFS14/src/modules/jump/JumpCenterpoint.cc @ 10050

Last change on this file since 10050 was 10050, checked in by fvultier, 10 years ago

Added a whole bunch of code

File size: 4.0 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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file JumpCenterpoint.cc
31    @brief Implementation of the JumpCenterpoint class.
32*/
33
34#include "JumpCenterpoint.h"
35
36#include "core/CoreIncludes.h"
37#include "core/XMLPort.h"
38
39#include "Jump.h"
40
41namespace orxonox
42{
43    RegisterClass(JumpCenterpoint);
44
45    /**
46    @brief
47        Constructor. Registers and initializes the object and checks whether the gametype is actually Jump.
48    */
49    JumpCenterpoint::JumpCenterpoint(Context* context) : StaticEntity(context)
50    {
51        RegisterObject(JumpCenterpoint);
52
53        // Variablen hier veraendern nuetzt nichts! Diese Variablen koennen in Level-File initialisiert werden.
54        width_ = 200;
55        height_ = 120;
56        sectionLength_ = 120;
57
58        this->checkGametype();
59    }
60
61    /**
62    @brief
63        Method to create a JumpCenterpoint through XML.
64    */
65    void JumpCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
66    {
67        SUPER(JumpCenterpoint, XMLPort, xmlelement, mode);
68
69        XMLPortParam(JumpCenterpoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode);
70        XMLPortParam(JumpCenterpoint, "sectionLength", setSectionLength, getSectionLength, xmlelement, mode);
71        XMLPortParam(JumpCenterpoint, "platformLength", setPlatformLength, getPlatformLength, xmlelement, mode);
72        XMLPortParam(JumpCenterpoint, "platformStaticTemplate", setPlatformStaticTemplate, getPlatformStaticTemplate, xmlelement, mode);
73        XMLPortParam(JumpCenterpoint, "platformHMoveTemplate", setPlatformHMoveTemplate, getPlatformHMoveTemplate, xmlelement, mode);
74        XMLPortParam(JumpCenterpoint, "platformVMoveTemplate", setPlatformVMoveTemplate, getPlatformVMoveTemplate, xmlelement, mode);
75        XMLPortParam(JumpCenterpoint, "platformDisappearTemplate", setPlatformDisappearTemplate, getPlatformDisappearTemplate, xmlelement, mode);
76        XMLPortParam(JumpCenterpoint, "platformTimerTemplate", setPlatformTimerTemplate, getPlatformTimerTemplate, xmlelement, mode);
77        XMLPortParam(JumpCenterpoint, "platformFakeTemplate", setPlatformFakeTemplate, getPlatformFakeTemplate, xmlelement, mode);
78        XMLPortParam(JumpCenterpoint, "figureTemplate", setFigureTemplate, getFigureTemplate, xmlelement, mode);
79        XMLPortParam(JumpCenterpoint, "projectileTemplate", setProjectileTemplate, getProjectileTemplate, xmlelement, mode);
80        XMLPortParam(JumpCenterpoint, "enemy1Template", setEnemy1Template, getEnemy1Template, xmlelement, mode);
81    }
82
83    /**
84    @brief
85        Is called when the gametype has changed.
86    */
87    void JumpCenterpoint::changedGametype()
88    {
89        SUPER(JumpCenterpoint, changedGametype);
90
91        // Check, whether it's still Jump.
92        this->checkGametype();
93    }
94
95    /**
96    @brief
97        Checks whether the gametype is Jump and if it is, sets its centerpoint.
98    */
99    void JumpCenterpoint::checkGametype()
100    {
101        if (this->getGametype() != NULL && this->getGametype()->isA(Class(Jump)))
102        {
103            Jump* jumpGametype = orxonox_cast<Jump*>(this->getGametype().get());
104            jumpGametype->setCenterpoint(this);
105        }
106    }
107}
Note: See TracBrowser for help on using the repository browser.