Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.cc @ 11610

Last change on this file since 11610 was 11610, checked in by remartin, 6 years ago
File size: 4.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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      Simon Miescher
26 *
27 */
28
29/*
30
31*
32*
33*<OFFEN Describe
34*
35*
36
37*/
38
39
40#include "../../orxonox/worldentities/pawns/Pawn.h"
41#include "../../orxonox/worldentities/WorldEntity.h"
42
43#include "SpicedAsteroidField.h"
44
45#include <algorithm>
46
47#include "core/CoreIncludes.h"
48#include "core/GameMode.h"
49#include "core/XMLPort.h"
50#include "core/EventIncludes.h"
51#include "network/NetworkFunction.h"
52
53// #include "infos/PlayerInfo.h"
54// #include "controllers/Controller.h"
55// #include "gametypes/Gametype.h"
56// #include "graphics/ParticleSpawner.h"
57// #include "worldentities/ExplosionChunk.h"
58// #include "worldentities/ExplosionPart.h"
59
60// #include "core/object/ObjectListIterator.h"
61// #include "controllers/FormationController.h"
62
63#include "../pickup/items/HealthPickup.h"
64#include "../pickup/PickupSpawner.h"
65#include "../pickup/Pickup.h"
66//#include "../pickup/pickup ..... pickupable
67#include "../objects/collisionshapes/SphereCollisionShape.h"
68#include "../../orxonox/graphics/Model.h"
69
70
71
72
73
74
75namespace orxonox
76{
77    RegisterClass(SpicedAsteroidField);
78
79    SpicedAsteroidField::SpicedAsteroidField(Context* context) {
80
81        // Da auch noetig? Wegen set in XML-Code?
82        RegisterObject(SpicedAsteroidField);
83
84        this->context = context;
85        this->initialised = false;
86
87        //Noetig, damit nicht sofort zerstoert?
88        this->setCollisionType(WorldEntity::CollisionType::Dynamic);
89
90        // Old from Pawn
91        this->registerVariables();
92
93        orxout() << "AsteroidMining:: Pseudo-Konstruktor passiert!" << endl;
94
95    }
96
97    SpicedAsteroidField::~SpicedAsteroidField(){
98
99    }
100
101    void SpicedAsteroidField::create(){
102
103
104
105
106    }
107
108    void SpicedAsteroidField::XMLPort(Element& xmlelement, XMLPort::Mode mode)
109    {
110        SUPER(SpicedAsteroidField, XMLPort, xmlelement, mode);
111        //        XMLPortParam(PickupSpawner, "pickup", setPickupTemplateName, getPickupTemplateName, xmlelement, mode);
112        XMLPortParam(SpicedAsteroidField, "size", setSize, getSize, xmlelement, mode);
113
114    }
115
116    void SpicedAsteroidField::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
117    {
118        SUPER(SpicedAsteroidField, XMLEventPort, xmlelement, mode);
119
120        XMLPortEventState(SpicedAsteroidField, BaseObject, "vulnerability", setVulnerable, xmlelement, mode);
121    }
122
123    void SpicedAsteroidField::registerVariables()
124    {
125        // registerVariable(this->bAlive_,            VariableDirection::ToClient);
126        // registerVariable(this->bVulnerable_,       VariableDirection::ToClient);
127        // registerVariable(this->health_,            VariableDirection::ToClient);
128        // registerVariable(this->maxHealth_,         VariableDirection::ToClient);
129
130        registerVariable(this->size, VariableDirection::ToClient);
131        registerVariable(this->generateSmaller, VariableDirection::ToClient);
132
133        registerVariable(this->initialised, VariableDirection::ToClient);
134        //registerVariable(this->context, VariableDirection::ToClient); // can't link that since it's a context
135
136
137            //         float size;
138            // bool generateSmaller;
139            // bool initialised;
140
141            // Context* context;
142    }
143
144    void SpicedAsteroidField::tick(float dt)
145    {
146
147        this->create();
148        this->~SpicedAsteroidField(); // seems dangerous. Necessary for efficiency?
149
150
151    }
152
153    void SpicedAsteroidField::setSize(float s){
154        this->size = s;
155    }
156
157    float SpicedAsteroidField::getSize(){
158        return this->size;
159    }
160
161
162
163}
Note: See TracBrowser for help on using the repository browser.