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 | * Johannes Ritz |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #include "Mission.h" |
---|
30 | #include "items/Engine.h" |
---|
31 | #include "controllers/ArtificialController.h" |
---|
32 | |
---|
33 | #include "core/CoreIncludes.h" |
---|
34 | #include "network/Host.h" |
---|
35 | #include "worldentities/pawns/Pawn.h" |
---|
36 | |
---|
37 | namespace orxonox |
---|
38 | { |
---|
39 | RegisterUnloadableClass(Mission); |
---|
40 | |
---|
41 | Mission::Mission(Context* context) : TeamGametype(context) |
---|
42 | { |
---|
43 | RegisterObject(Mission); |
---|
44 | this->missionAccomplished_ = false; |
---|
45 | this->lives_ = 10; // should be 1 as default value |
---|
46 | this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 |
---|
47 | } |
---|
48 | |
---|
49 | void Mission::tick(float dt) |
---|
50 | { |
---|
51 | SUPER(Mission, tick, dt); |
---|
52 | |
---|
53 | if (missionAccomplished_) |
---|
54 | { |
---|
55 | this->gtinfo_->sendAnnounceMessage("Mission accomplished!"); |
---|
56 | this->end(); |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | void Mission::pawnKilled(Pawn* victim, Pawn* killer) |
---|
61 | { |
---|
62 | if (victim && victim->getPlayer() && this->lives_ == 1) |
---|
63 | { |
---|
64 | this->missionAccomplished_ = false; |
---|
65 | this->end(); |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | void Mission::start() |
---|
70 | { |
---|
71 | Gametype::start(); |
---|
72 | this->setTeams(); |
---|
73 | |
---|
74 | this->gtinfo_->sendAnnounceMessage("Your mission has started!"); |
---|
75 | } |
---|
76 | |
---|
77 | void Mission::end() |
---|
78 | { |
---|
79 | Gametype::end(); |
---|
80 | /*if (this->missionAccomplished_) |
---|
81 | this->gtinfo_->sendAnnounceMessage("Mission accomplished!"); |
---|
82 | else |
---|
83 | this->gtinfo_->sendAnnounceMessage("Mission failed!"); |
---|
84 | */ |
---|
85 | } |
---|
86 | |
---|
87 | void Mission::setTeams() |
---|
88 | {//Set pawn-colours |
---|
89 | for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) |
---|
90 | { |
---|
91 | Pawn* pawn = static_cast<Pawn*>(*it); |
---|
92 | if(!pawn) continue; |
---|
93 | this->setDefaultObjectColour(pawn); |
---|
94 | } |
---|
95 | } |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | } |
---|