Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.cc @ 8940

Last change on this file since 8940 was 8940, checked in by eceline, 12 years ago

level Spacerace2

File size: 2.5 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 *     Mauro Salomon
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "SpaceRaceManager.h"
30#include "SpaceRace.h"
31#include "infos/PlayerInfo.h"
32
33#include "core/XMLPort.h"
34
35#include "core/CoreIncludes.h"
36
37#include "util/Convert.h"
38#include "util/Math.h"
39
40namespace orxonox
41{
42    CreateFactory(SpaceRaceManager);
43
44    SpaceRaceManager::SpaceRaceManager(BaseObject* creator) : BaseObject(creator)
45    {
46        RegisterObject(SpaceRaceManager);
47               
48    }
49
50   SpaceRaceManager::~SpaceRaceManager()
51    {
52        if (this->isInitialized())
53        {
54            for (size_t i = 0; i < this->checkpoints_.size(); ++i)
55                this->checkpoints_[i]->destroy();
56        }
57    }
58   
59     void SpaceRaceManager::addCheckpoint(RaceCheckPoint* checkpoint)
60    {
61        this->checkpoints_.push_back(checkpoint);
62    }
63
64    RaceCheckPoint* SpaceRaceManager::getCheckpoint(unsigned int index) const
65    {
66        if (index < this->checkpoints_.size())
67            return this->checkpoints_[index];
68        else
69            return 0;
70    }
71   
72     void SpaceRaceManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
73    {
74        SUPER(SpaceRaceManager, XMLPort, xmlelement, mode);
75
76        //XMLPortParam(WaypointController, "accuracy", setAccuracy, getAccuracy, xmlelement, mode).defaultValues(100.0f);
77        XMLPortObject(SpaceRaceManager, RaceCheckPoint, "checkpoints", addCheckpoint, getCheckpoint,  xmlelement, mode);
78    }
79   
80    void SpaceRaceManager::tick(float dt)
81    {
82    SUPER(SpaceRaceManager,tick,dt);
83     SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
84     gametype->setV(this);
85         
86       
87     
88    }
89}
90
91
Note: See TracBrowser for help on using the repository browser.