Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickupsFS14/src/modules/jump/Jump.cc @ 10005

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

Initial checkin

File size: 5.4 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 *      Florian Zinggeler
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file Jump.cc
31    @brief Implementation of the Jump class.
32*/
33
34#include "Jump.h"
35#include "core/CoreIncludes.h"
36#include "core/EventIncludes.h"
37#include "core/command/Executor.h"
38#include "core/config/ConfigValueIncludes.h"
39
40#include "gamestates/GSLevel.h"
41#include "chat/ChatManager.h"
42
43// ! HACK
44#include "infos/PlayerInfo.h"
45
46#include "JumpCenterPoint.h"
47#include "JumpShip.h"
48/*
49#include "JumpEnemy.h"
50#include "JumpEnemyShooter.h"*/
51
52#include "core/command/ConsoleCommand.h"
53#include "worldentities/BigExplosion.h"
54
55namespace orxonox
56{
57    RegisterUnloadableClass(Jump);
58
59    Jump::Jump(Context* context) : Deathmatch(context)
60    {
61        RegisterObject(Jump);
62        //this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
63        //this->center_ = 0;
64       // init();
65        //this->setHUDTemplate("JumpHUD");
66    }
67
68    void Jump::init()
69    {
70        /*bEndGame = false;
71        lives = 3;
72        level = 1;
73        point = 0;
74        bShowLevel = false;
75        multiplier = 1;
76        b_combo = false;*/
77        // spawn enemy every 3.5 seconds
78        //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Jump::spawnEnemy, this)));
79        //comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&Jump::comboControll, this)));
80    }
81
82    /*void Jump::levelUp()
83    {
84        level++;
85        if (getPlayer() != NULL)
86        {
87            for (int i = 0; i < 7; i++)
88            {
89                WeakPtr<BigExplosion> chunk = new BigExplosion(this->center_->getContext());
90                chunk->setPosition(Vector3(600, 0, 100.f * i - 300));
91                chunk->setVelocity(Vector3(1000, 0, 0));  //player->getVelocity()
92                chunk->setScale(20);
93            }
94        }
95        addPoints(multiplier * 42);
96        multiplier *= 2;
97        toggleShowLevel();
98        showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&Jump::toggleShowLevel, this)));
99    }*/
100
101    WeakPtr<JumpShip> Jump::getPlayer()
102    {
103        if (player == NULL)
104        {
105                ObjectList<JumpShip>::iterator it;
106                it = ObjectList<JumpShip>::begin();
107                /*for (ObjectList<JumpShip>::iterator it = ObjectList<JumpShip>::begin(); it != ObjectList<JumpShip>::end(); ++it)
108                {
109                player = *it;
110                }*/
111        }
112        return player;
113    }
114
115    /*void Jump::spawnEnemy()
116    {
117        if (getPlayer() == NULL)
118            return;
119
120        for (int i = 0; i < (3*log10(static_cast<double>(level)) + 1); i++)
121        {
122            WeakPtr<JumpEnemy> newPawn;
123            if (rand() % 42/(1 + level*level) == 0)
124            {
125                newPawn = new JumpEnemyShooter(this->center_->getContext());
126                newPawn->addTemplate("enemyjumpshooter");
127            }
128            else
129            {
130                newPawn = new JumpEnemy(this->center_->getContext());
131                newPawn->addTemplate("enemyjump");
132            }
133            newPawn->setPlayer(player);
134            newPawn->level = level;
135            // spawn enemy at random points in front of player.
136            newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
137        }
138    }*/
139
140    /*void Jump::costLife()
141    {
142        lives--;
143        multiplier = 1;
144        // end the game in 30 seconds.
145        if (lives <= 0)
146            enemySpawnTimer.setTimer(30.0f, false, createExecutor(createFunctor(&Jump::end, this)));
147    };*/
148
149    /*void Jump::comboControll()
150    {
151        if (b_combo)
152            multiplier++;
153        // if no combo was performed before, reset multiplier
154        else
155            multiplier = 1;
156        b_combo = false;
157    }*/
158
159    /*void Jump::start()
160    {
161        init();
162        // Set variable to temporarily force the player to spawn.
163        this->bForceSpawn_ = true;
164
165        if (this->center_ == NULL)  // abandon mission!
166        {
167            orxout(internal_error) << "Jump: No Centerpoint specified." << endl;
168            GSLevel::startMainMenu();
169            return;
170        }
171        // Call start for the parent class.
172        Deathmatch::start();
173    }*/
174
175    /*void Jump::addPoints(int numPoints)
176    {
177        if (!bEndGame)
178        {
179            point += numPoints * multiplier;
180            b_combo = true;
181        }
182    }*/
183
184    /*void Jump::end()
185    {
186        // DON'T CALL THIS!
187        //      Deathmatch::end();
188        // It will misteriously crash the game!
189        // Instead startMainMenu, this won't crash.
190        GSLevel::startMainMenu();
191    }*/
192}
Note: See TracBrowser for help on using the repository browser.