Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.h @ 9517

Last change on this file since 9517 was 9517, checked in by jo, 11 years ago

Little code cleanup.

File size: 3.1 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 *
23 *  Created on: Oct 8, 2012
24 *      Author: purgham
25 */
26
27#ifndef SPACERACECONTROLLER_H_
28#define SPACERACECONTROLLER_H_
29
30#include "gametypes/GametypesPrereqs.h"
31#include "controllers/ArtificialController.h"
32#include "gametypes/Gametype.h"
33#include "gametypes/RaceCheckPoint.h"
34#include "util/Math.h"
35
36namespace orxonox
37{
38    class _GametypesExport SpaceRaceController: public ArtificialController,
39            public Tickable
40    {
41        private:
42            std::vector<RaceCheckPoint*> staticRacePoints_;
43            RaceCheckPoint* nextRaceCheckpoint_; // checkpoint that should be reached
44            RaceCheckPoint* currentRaceCheckpoint_; // last checkPoint (already reached)
45            std::vector<RaceCheckPoint*> checkpoints_;
46            Vector3 lastPositionSpaceship;
47            int virtualCheckPointIndex;
48
49            int recCalculateDistance(RaceCheckPoint*, Vector3 currentPosition);
50            int distanceSpaceshipToCheckPoint(RaceCheckPoint*);
51            RaceCheckPoint* nextPointFind(RaceCheckPoint*);
52            RaceCheckPoint* adjustNextPoint();
53            std::vector<RaceCheckPoint*> findStaticCheckpoints(std::vector<
54                    RaceCheckPoint*>);
55            std::vector<RaceCheckPoint*> staticCheckpoints();
56            int rekSimulationCheckpointsReached(RaceCheckPoint*, std::map<
57                    RaceCheckPoint*, int>*);
58            // same as SpaceRaceManager, but needed to add virtuell Checkpoints ( Checkpoints which don't exist but needed to avoid collisions with big Objects)
59            RaceCheckPoint* findCheckpoint(int index) const;
60            RaceCheckPoint
61                    * addVirtualCheckPoint(RaceCheckPoint*, int , Vector3);
62            void placeVirtualCheckpoints(RaceCheckPoint*, RaceCheckPoint*);
63            bool vergleicheQuader(Vector3, Vector3);
64            bool directLinePossible(RaceCheckPoint*, RaceCheckPoint*, std::vector<StaticEntity*>);
65            void computeVirtualCheckpoint(RaceCheckPoint*, RaceCheckPoint*, std::vector<StaticEntity*>);
66
67        public:
68            SpaceRaceController(BaseObject* creator);
69            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
70            virtual ~SpaceRaceController();
71            virtual void tick(float dt);
72    };
73
74}
75
76#endif /* SPACERACECONTROLLER_H_ */
Note: See TracBrowser for help on using the repository browser.