[Orxonox-commit 7457] r12064 - in code/branches/TixyTaxyTorxy_HS18: data/levels data/overlays src/modules src/modules/TixyTaxyTorxy
sastocke at orxonox.net
sastocke at orxonox.net
Wed Oct 31 11:02:38 CET 2018
Author: sastocke
Date: 2018-10-31 11:02:38 +0100 (Wed, 31 Oct 2018)
New Revision: 12064
Added:
code/branches/TixyTaxyTorxy_HS18/data/levels/TixyTaxyTorxy.oxw
code/branches/TixyTaxyTorxy_HS18/data/overlays/TixyTaxyTorxyHUD.oxo
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/CMakeLists.txt
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.cc
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.h
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCenterpoint.cc
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCenterpoint.h
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCoordinate.cc
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCoordinate.h
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.cc
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.h
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyHUDController.cc
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyHUDController.h
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxySelecter.cc
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxySelecter.h
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.cc
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.h
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyreadme.txt
Log:
second initial setup
Added: code/branches/TixyTaxyTorxy_HS18/data/levels/TixyTaxyTorxy.oxw
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/data/levels/TixyTaxyTorxy.oxw (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/data/levels/TixyTaxyTorxy.oxw 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,277 @@
+<!-- TODO: Update the level's image-->
+
+<!-- See TixyTaxyTorxyReadme.txt for Information on this file -->
+
+<LevelInfo
+ name = "TixyToxyTorxy"
+ description = "Defend your Spacestation from incoming waves."
+ tags = "minigame"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("TixyTaxyTorxyHUD.oxo")
+ include("templates/lodInformation.oxt")
+ include("includes/weaponSettingsTurret.oxi")
+ include("templates/spaceshipAssff.oxt")
+ include("templates/standardTurret.oxt")
+?>
+
+<Template name=selectercameras defaults=0>
+ <TixyTaxyTorxySelecter>
+ <camerapositions>
+ <CameraPosition position="0,0,1300" lookat="0,0,0" absolute=true drag=true mouselook=true/>
+ </camerapositions>
+ </TixyTaxyTorxySelecter>
+</Template>
+
+<Template name=selectertemplate>
+ <TixyTaxyTorxySelecter team=0 camerapositiontemplate=selectercameras>
+ <attached>
+ <Model position="0,0,0" pitch=90 mesh="TD_Selection.mesh" scale=25/>
+ </attached>
+ </TixyTaxyTorxySelecter>
+</Template>
+
+<Template name=tower1template>
+ <TixyTaxyTorxyTower
+ explosionchunks=6
+ shieldrechargerate=10
+ shieldrechargewaittime=5
+ collisionType="none"
+ pitch="0"
+ yaw="0"
+ roll="0"
+ maxPitch=360
+ maxYaw=360
+ maxAttackRadius=1000
+ minAttackRadius=0
+ team=0
+ >
+ <controller>
+ <TurretController team = 0/>
+ </controller>
+ <weaponslots>
+ <WeaponSlot position="0,0,0" />
+ </weaponslots>
+ <weaponsets>
+ <WeaponSet firemode=0 />
+ </weaponsets>
+ <weaponpacks>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+ </links>
+ <Weapon>
+ <HsW01 mode=0 munitionpershot=0 muzzleoffset="0,0,0" damage=2 shielddamage=1 material="Flares/point_lensflare" delay=0/>
+ </Weapon>
+ </WeaponPack>
+ </weaponpacks>
+ <munition>
+ <LaserMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10 replenishamount=1 replenishinterval=0.3/>
+ </munition>
+ </TixyTaxyTorxyTower>
+</Template>
+
+<Template name=tower2template>
+ <TixyTaxyTorxyTower
+ explosionchunks=6
+ shieldrechargerate=10
+ shieldrechargewaittime=5
+ collisionType="none"
+ pitch="0"
+ yaw="0"
+ roll="0"
+ maxPitch=360
+ maxYaw=360
+ maxAttackRadius=1000
+ minAttackRadius=0
+ team=0
+ >
+ <controller>
+ <TurretController team = 0/>
+ </controller>
+ <weaponslots>
+ <WeaponSlot position="0,0,0" />
+ </weaponslots>
+ <weaponsets>
+ <WeaponSet firemode=0 />
+ </weaponsets>
+ <weaponpacks>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+ </links>
+ <Weapon>
+ <LightningGun mode=0 munitionpershot=0 muzzleoffset="0,0,0" damage=2 shielddamage=4 />
+ </Weapon>
+ </WeaponPack>
+ </weaponpacks>
+ <munition>
+ <LightningMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10/>
+ </munition>
+ <attached>
+ <Backlight position="0,0,0" scale=2.0 colour="0.4, 0.0, 1.0" width=10 length=10 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </TixyTaxyTorxyTower>
+</Template>
+
+<Template name=tower3template>
+ <TixyTaxyTorxyTower
+ explosionchunks=6
+ shieldrechargerate=10
+ shieldrechargewaittime=5
+ collisionType="none"
+ pitch="0"
+ yaw="0"
+ roll="0"
+ maxPitch=360
+ maxYaw=360
+ maxAttackRadius=1000
+ minAttackRadius=0
+ team=0
+ >
+ <controller>
+ <TurretController team = 0/>
+ </controller>
+ <weaponslots>
+ <WeaponSlot position="0,0,0" />
+ </weaponslots>
+ <weaponsets>
+ <WeaponSet firemode=0 />
+ </weaponsets>
+ <weaponpacks>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+ </links>
+ <Weapon>
+ <SplitGun mode=0 munitionpershot=0 damage=9.3 muzzleoffset=" 1.6, 1.3, -2.0" splittime=0.2 numberofsplits=2 numberofchilds=5 spread=0.1 damagereduction=3.0 />
+ </Weapon>
+ </WeaponPack>
+ </weaponpacks>
+ <munition>
+ <SplitMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10/>
+ </munition>
+ </TixyTaxyTorxyTower>
+</Template>
+
+<Template name=tower4template>
+ <TixyTaxyTorxyTower
+ explosionchunks=6
+ shieldrechargerate=10
+ shieldrechargewaittime=5
+ collisionType="none"
+ pitch="0"
+ yaw="0"
+ roll="0"
+ maxPitch=360
+ maxYaw=360
+ maxAttackRadius=1000
+ minAttackRadius=0
+ team=0
+ >
+ <controller>
+ <TurretController team = 0/>
+ </controller>
+ <weaponslots>
+ <WeaponSlot position="0,0,0" />
+ </weaponslots>
+ <weaponsets>
+ <WeaponSet firemode=0 />
+ </weaponsets>
+ <weaponpacks>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+ </links>
+ <Weapon>
+ <RocketFire mode=0 munitionpershot=0 muzzleoffset="0,0,0" damage=2 shielddamage=4 fuel=10/>
+ </Weapon>
+ </WeaponPack>
+ </weaponpacks>
+ <munition>
+ <RocketMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10/>
+ </munition>
+ <attached>
+ <ParticleSpawner position="0,0,0" source="Orxonox/sparks" lifetime=3.0 autostart=1 loop=1 />
+ </attached>
+ </TixyTaxyTorxyTower>
+</Template>
+
+<Level plugins = "TixyTaxyTorxy" gametype = "TixyTaxyTorxy">
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+
+ <SpawnPoint team=0 position="0,0,0"/>
+
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_S1.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_S2.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_S3.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_S4.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_S5.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_T1.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_T2.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_T3.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_T4.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_T5.mesh" scale=1/>
+ <Model position="0,0,10000" lodLevel=1 mesh="TD_F1.mesh" scale=1/>
+
+ <!-- PlayField -->
+ <TixyTaxyTorxyCenterpoint
+ name=TixyTaxyTorxycenter
+ selecterTemplate=selectertemplate
+ tower1Template=tower1template
+ tower2Template=tower2template
+ tower3Template=tower3template
+ tower4Template=tower4template
+ tower5Template=tower5template
+ tower1Cost=100
+ tower2Cost=100
+ tower3Cost=100
+ tower4Cost=100
+ tower5Cost=100
+ fields="F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1
+ F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1"
+ width=16
+ height=16
+ tileScale=100
+ position="0,0,0"
+ direction="0,0,0"
+ collisionType=dynamic
+ mass=100000
+ >
+ <camerapositions>
+ <CameraPosition position="0,0,1400" lookat="0,0,0" absolute=true />
+ </camerapositions>
+ </TixyTaxyTorxyCenterpoint>
+
+ </Scene>
+</Level>
+
Added: code/branches/TixyTaxyTorxy_HS18/data/overlays/TixyTaxyTorxyHUD.oxo
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/data/overlays/TixyTaxyTorxyHUD.oxo (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/data/overlays/TixyTaxyTorxyHUD.oxo 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,82 @@
+<Template name="TixyTaxyTorxyHUD">
+
+
+ <OverlayGroup name="TixyTaxyTorxyHUD" scale = "1, 1">
+
+
+ <OverlayText
+ position = "0.83, 0.05"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.05
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+
+ caption = "Cash:"
+ />
+
+
+ <TixyTaxyTorxyHUDController
+ position = "0.88, 0.10"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.05
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+ showlives = false
+ showcredits = true
+ showwaves = false
+ />
+
+ <OverlayText
+ position = "0.83, 0.22"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.05
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+
+ caption = "Lifes:"
+ />
+
+ <TixyTaxyTorxyHUDController
+ position = "0.88, 0.27"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.05
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+ showlives = true
+ showcredits = false
+ showwaves = false
+ />
+
+ <OverlayText
+ position = "0.83, 0.39"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.05
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+
+ caption = "Waves:"
+ />
+
+ <TixyTaxyTorxyHUDController
+ position = "0.88, 0.44"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.05
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+ showlives = false
+ showcredits = false
+ showwaves = true
+
+ />
+
+
+ </OverlayGroup>
+</Template>
+
+
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/CMakeLists.txt
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/CMakeLists.txt (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/CMakeLists.txt 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,20 @@
+SET_SOURCE_FILES(TixyTaxyTorxy_SRC_FILES
+ TixyTaxyTorxy.cc
+ TixyTaxyTorxyTower.cc
+ TixyTaxyTorxyCenterpoint.cc
+ TixyTaxyTorxyHUDController.cc
+ TixyTaxyTorxyCoordinate.cc
+ TixyTaxyTorxySelecter.cc
+ TixyTaxyTorxyField.cc
+ TixyTaxyTorxyCoordinate.cc
+)
+
+ORXONOX_ADD_LIBRARY(TixyTaxyTorxy
+ PLUGIN
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ overlays
+ objects
+ SOURCE_FILES ${TixyTaxyTorxy_SRC_FILES}
+)
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.cc
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.cc (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.cc 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,272 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ *
+ * Co-authors:
+ * ...
+ *
+ *NACHRICHT:
+ *
+ * Hier empfehle ich euch die gesamte Spielogik unter zu bringen. Viele Funktionen werden automatisch
+ * bei gewissen Ereignissen aufgerufen bzw. lösen Ereignisse aus
+ *
+ *Z.B:
+ * start() //wird aufgerufen, bevor das Spiel losgeht
+ * end() //wenn man diese Funktion aufruft wird
+ * pawnKilled() // wird aufgerufen, wenn ein Pawn stirbt (z.B: wenn )
+ * playerScored() // kann man aufrufen um dem Spieler Punkte zu vergeben.
+ *
+ *
+ *TIPP: Eclipse hilft euch schnell auf bereits vorhanden Funktionen zuzugreifen:
+ * einfach "this->" eingeben und kurz warten. Dann tauch eine Liste mit Vorschlägen auf. Wenn ihr jetzt weiter
+ * tippt, werden die Vorschläge entsprechend gefiltert.
+ *
+ *
+ *TIPP: schaut euch mal Tetris::createStone() an. Dort wird ein TetrisStone-Objekt (ControllableEntity) erzeugt,
+ * ihm ein Template zugewiesen (welches vorher im Level definiert wurde und dem CenterPoint übergeben wurde)
+ * Ähnlich könnt ihr vorgehen, um einen Turm zu erzeugen. (Zusätzlich braucht ein Turm noch einen Controller)
+ * z.B: WaypointPatrolController. Wenn kein Team zugewiesen wurde bekämpft ein WaypointPatrolController alles,
+ * was in seiner Reichweite liegt.
+ *
+ *
+ *HUD:
+ * Ein Gametype kann ein HUD (Head up Display haben.) Z.B: hat Pong eine Anzeige welcher Spieler wieviele Punkte hat.
+ * Generell kann man a) Grafiken oder b) Zeichen in einer HUD anzeigen.
+ * Fuer den ersten Schritt reicht reiner Text.
+ *
+ * a)
+ * PongScore.cc uebernehmen und eigene Klasse draus machen.
+ * Wenn ihr bloss anzeigen wollt wieviele Punkte der Spieler bereits erspielt hat (Punkte = Kapital fuer neue Tuerme) dann orientiert ihr euch an
+ * TetrisScore.cc (im pCuts branch): http://www.orxonox.net/browser/code/branches/pCuts/src/modules/tetris/TetrisScore.cc
+ * Ich habe TetrisScore lediglich dazu gebraucht, um eine Variable auf dem HUD auszugeben. Ein Objekt fuer statischen Text gibt es bereits.
+ *
+ * b)
+ * Im naesten Schritt erstellt man die Vorlage fuer das HUD-Objekt: siehe /data/overlays/pongHUD
+ * OverlayText ist eine Vorlage fuer statischen text zb: "Points Scored:". Aus mir nicht erklaerlichen Gruenden sollte man die OverlayText
+ * Objekte immer erst nach dem PongScore anlegen.
+ *
+ * c) Im TixyTaxyTorxy
+TixyTaxyTorxy gamtype muss im Constructor noch das HUD-Template gesetzt werden.
+ *
+ * d) in CMakeLists.txt noch das Module includen das fuer die Overlays zustaendig ist. Siehe das gleiche File im Pong module.
+ *
+ *
+ *
+ */
+#include "TixyTaxyTorxy.h"
+#include "TixyTaxyTorxyTower.h"
+#include "TixyTaxyTorxyCenterpoint.h"
+#include "worldentities/SpawnPoint.h"
+#include "controllers/WaypointController.h"
+#include "graphics/Model.h"
+#include "infos/PlayerInfo.h"
+#include "chat/ChatManager.h"
+#include "core/CoreIncludes.h"
+#include "Highscore.h"
+
+namespace orxonox
+{
+ RegisterUnloadableClass(TixyTaxyTorxy);
+
+
+TixyTaxyTorxy::TixyTaxyTorxy(Context* context) : TeamDeathmatch(context)
+ {
+ RegisterObject(TixyTaxyTorxy);
+
+ selecter = nullptr;
+ this->player_ = nullptr;
+ this->setHUDTemplate("TixyTaxyTorxyHUD");
+ this->waveNumber_ = 0;
+ this->timeSinceLastSpawn_ = 0.0;
+ this->timeUntilNextWave_ = 0.0;
+ this->credit_ = 0;
+ this->lifes_ = 0;
+ this->waveSize_ = 0;
+ offset_ = Vector3(0,0,10);
+ }
+
+TixyTaxyTorxy::~TixyTaxyTorxy()
+ {
+ if (this->isInitialized())
+ {
+
+ }
+ }
+
+ void TixyTaxyTorxy::setCenterpoint(TixyTaxyTorxyCenterpoint *centerpoint)
+ {
+ this->center_ = centerpoint;
+ }
+
+ void TixyTaxyTorxy::start()
+ {
+ if (center_ != nullptr) // There needs to be a TixyTaxyTorxyCenterpoint, i.e. the area the game takes place.
+ {
+ if (selecter == nullptr)
+ {
+ selecter = new TixyTaxyTorxySelecter(this->center_->getContext());
+ }
+ selecter->addTemplate(center_->getSelecterTemplate());
+ center_->attach(selecter);
+ }
+ else // If no centerpoint was specified, an error is thrown and the level is exited.
+ {
+ orxout(internal_error) << "Jump: No Centerpoint specified." << endl;
+ return;
+ }
+
+ createFields();
+ TeamDeathmatch::start();
+
+ //set initial credits, lifes and WaveNumber
+ this->setCredit(1000);
+ this->setLifes(100);
+ this->timeSinceLastSpawn_ = 0.0;
+ this->timeUntilNextWave_ = 5.0;
+ this->waveSize_ = 0;
+ this->setWaveNumber(0);
+ }
+
+
+ void TixyTaxyTorxy::end()
+ {
+ if (Highscore::exists())
+ {
+ int score = this->getWaveNumber();
+ Highscore::getInstance().storeScore("Tower Defense", score, this->getPlayer());
+ }
+ TeamDeathmatch::end();
+ ChatManager::message("Match is over! Gameover!");
+
+ }
+
+ void TixyTaxyTorxy::spawnPlayer(PlayerInfo* player)
+ {
+ assert(player);
+ player_ = player;
+
+ if (selecter->getPlayer() == nullptr)
+ {
+ player_->startControl(selecter);
+ players_[player].state_ = PlayerState::Alive;
+ }
+ }
+
+ /**
+ @brief
+ Get the player.
+ @return
+ Returns a pointer to the player. If there is no player, nullptr is returned.
+ */
+ PlayerInfo* TixyTaxyTorxy::getPlayer(void) const
+ {
+ return this->player_;
+ }
+
+ //not working yet
+ void TixyTaxyTorxy::addTower(int x,int y)
+ {
+ TixyTaxyTorxyCoordinate* coord = new TixyTaxyTorxyCoordinate(x,y);
+ x = coord->GetX();
+ y = coord->GetY();
+
+ int cost = center_->getTowerCost(1);
+
+ if (fields_[x][y]->isFree() == true && getCredit() >= cost)
+ {
+ payCredit(cost);
+ fields_[x][y]->createTower(1);
+ }
+ }
+
+ /*adds Tower at Position (x,y) and reduces credit and adds the point to the towermatrix. template ("towerturret")
+ so towers have ability if the turrets
+ */
+
+ void TixyTaxyTorxy::upgradeTower(int x, int y)
+ {
+ TixyTaxyTorxyCoordinate* coord = new TixyTaxyTorxyCoordinate(x,y);
+ x = coord->GetX();
+ y = coord->GetY();
+
+ int cost = center_->getTowerCost(fields_[x][y]->getUpgrade() + 1);
+
+ if (fields_[x][y]->isFree() == false && fields_[x][y]->canUpgrade() == true && getCredit() >= cost)
+ {
+ payCredit(cost);
+ fields_[x][y]->upgrade();
+ }
+ }
+
+ void TixyTaxyTorxy::tick(float dt)
+ {
+ SUPER(TixyTaxyTorxy, tick, dt);
+
+ if (hasStarted() == false || player_ == nullptr)
+ {
+ return;
+ }
+ timeUntilNextWave_ -= dt;
+ timeSinceLastSpawn_ += dt;
+
+ //build/upgrade tower at selecter position
+ if (selecter != nullptr && selecter->buildTower_ == true)
+ {
+ selecter->buildTower_ = false;
+
+ if (getField(selecter->selectedPos_)->canUpgrade() == true)
+ {
+ upgradeTower(selecter->selectedPos_->GetX(), selecter->selectedPos_->GetY());
+ }
+ else
+ {
+ addTower(selecter->selectedPos_->GetX(), selecter->selectedPos_->GetY());
+ }
+ }
+
+
+ }
+
+ void TixyTaxyTorxy::createFields()
+ {
+ assert(center_);
+ TixyTaxyTorxyCoordinate coord(0,0);
+ TixyTaxyTorxyCoordinate startCoord(0,0);
+ std::string fields = center_->getFields();
+ int pos = 0;
+ for (int j = 15; j >= 0; --j)
+ {
+ for (int i = 0; i < 16; ++i)
+ {
+ coord.Set(i,j);
+ fields_[i][j] = new TixyTaxyTorxyField(center_->getContext());
+ fields_[i][j]->setCenterpoint(center_);
+ center_->attach(fields_[i][j]);
+ fields_[i][j]->setPosition(coord.get3dcoordinate());
+ fields_[i][j]->create(fields.at(pos), fields.at(pos+1));
+ pos += 2;
+
+ }
+ }
+ }
+
+}
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.h
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.h (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.h 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,96 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ *
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef _TixyTaxyTorxy_H__
+#define _TixyTaxyTorxy_H__
+#include "TixyTaxyTorxyCoordinate.h"
+#include "TixyTaxyTorxySelecter.h"
+#include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h"
+#include "gametypes/TeamDeathmatch.h"
+#include "util/Output.h"
+#include "TixyTaxyTorxyField.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ GameType class for TixyTaxyTorxy
+TixyTaxyTorxy. See TixyTaxyTorxy
+TixyTaxyTorxyReadme.txt for Information.
+
+ @ingroup TixyTaxyTorxy
+TixyTaxyTorxy
+ */
+ class _TixyTaxyTorxyExport TixyTaxyTorxy : public TeamDeathmatch
+ {
+ public:
+ TixyTaxyTorxy(Context* context);
+ virtual ~TixyTaxyTorxy();
+ virtual void start() override; //<! The function is called when the gametype starts
+ virtual void end() override;
+ virtual void tick(float dt) override;
+ virtual void spawnPlayer(PlayerInfo* player) override;
+ PlayerInfo* getPlayer(void) const;
+ int getCredit(){ return this->credit_; }
+ void payCredit(int pay){ this->credit_ -= pay; }
+ int getLifes(){ return this->lifes_; }
+ int getWaveNumber(){ return this->waveNumber_; }
+ void setWaveNumber(int wavenumber){ waveNumber_=wavenumber; }
+ void setCredit(int credit){ credit_ = credit; }
+ void setLifes(int lifes){ lifes_ = lifes; }
+ void buyTower(int cost){ cost -= cost;}
+ void addCredit(int credit) { credit_+=credit; }
+ int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; }
+ TixyTaxyTorxyField* getField(TixyTaxyTorxyCoordinate* coord){ return fields_[coord->GetX()][coord->GetY()]; }
+ void setCenterpoint(TixyTaxyTorxyCenterpoint* centerpoint);
+ void addTower(int x, int y);
+ void upgradeTower(int x, int y);
+
+ TixyTaxyTorxySelecter* selecter;
+
+ private:
+ void createFields();
+
+ orxonox::WeakPtr<TixyTaxyTorxyCenterpoint> center_;
+ PlayerInfo* player_;
+ float timeSinceLastSpawn_;
+ float timeUntilNextWave_;
+ int waveSize_;
+ int credit_;
+ int waveNumber_;
+ int lifes_;
+ TixyTaxyTorxyField* fields_[16][16];
+ std::vector<orxonox::WeakPtr<TixyTaxyTorxyField>> waypoints_;
+ Vector3 endpoint_;
+ Vector3 offset_;
+ };
+}
+
+#endif /* _TixyTaxyTorxy
+TixyTaxyTorxy_H__ */
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCenterpoint.cc
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCenterpoint.cc (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCenterpoint.cc 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,133 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TixyTaxyTorxy
+TixyTaxyTorxyCenterpoint.cc
+ @brief Implementation of the TixyTaxyTorxy
+TixyTaxyTorxyCenterpoint class.
+*/
+
+#include "TixyTaxyTorxyCenterpoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "core/class/Super.h"
+
+#include "TixyTaxyTorxy.h"
+
+namespace orxonox
+{
+ RegisterClass(TixyTaxyTorxyCenterpoint);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object and checks whether the gametype is actually TixyTaxyTorxy
+TixyTaxyTorxy.
+ */
+
+TixyTaxyTorxyCenterpoint::TixyTaxyTorxyCenterpoint(Context* context) : MobileEntity(context)
+ {
+ RegisterObject(TixyTaxyTorxyCenterpoint);
+
+ this->width_ = 15;
+ this->height_ = 15;
+
+ //this->setCollisionType(Static);
+
+ this->checkGametype();
+
+ }
+
+ /**
+ @brief
+ Method to create a TixyTaxyTorxy
+TixyTaxyTorxyCenterpoint through XML.
+ */
+ void TixyTaxyTorxyCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(TixyTaxyTorxyCenterpoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "width", setWidth, getWidth, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "height", setHeight, getHeight, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tileScale", setTileScale, getTileScale, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "selecterTemplate", setSelecterTemplate, getSelecterTemplate, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower1Template", setTower1Template, getTower1Template, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower2Template", setTower2Template, getTower2Template, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower3Template", setTower3Template, getTower3Template, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower4Template", setTower4Template, getTower4Template, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower5Template", setTower5Template, getTower5Template, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "fields", setFields, getFields, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower1Cost", setTower1Cost, getTower1Cost, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower2Cost", setTower2Cost, getTower2Cost, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower3Cost", setTower3Cost, getTower3Cost, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower4Cost", setTower4Cost, getTower4Cost, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyCenterpoint, "tower5Cost", setTower5Cost, getTower5Cost, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Checks whether the gametype is TixyTaxyTorxy
+TixyTaxyTorxy and if it is, sets its centerpoint.
+ */
+ void TixyTaxyTorxyCenterpoint::checkGametype()
+ {
+ if (this->getGametype() != nullptr && this->getGametype()->isA(Class(TixyTaxyTorxy)))
+ {
+ // Sets the centerpoint of the gametype. The gametype uses this to later spawn in towers, he needs the tower template stored in the center point
+ TixyTaxyTorxy* TixyTaxyTorxyGametype = orxonox_cast<TixyTaxyTorxy*>(this->getGametype());
+ TixyTaxyTorxyGametype->setCenterpoint(this);
+ }
+ }
+
+ /**
+ @brief
+ Removes all blanks, tabs and returns from the string passed.
+ */
+ void TixyTaxyTorxyCenterpoint::trimString(std::string* str)
+ {
+ std::string* trimmed = new std::string("");
+ int length = str->size();
+ char temp;
+ for (int i = 0; i < length; ++ i)
+ {
+ temp = str->at(i);
+ if (temp != ' ' && temp != '\t' && temp != '\n')
+ {
+ trimmed->push_back(temp);
+ }
+ }
+
+ *str = *trimmed;
+ }
+
+ const int TixyTaxyTorxyCenterpoint::getTowerCost(int upgrade) const
+ {
+ return towerCosts_[(upgrade%5)];
+ }
+}
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCenterpoint.h
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCenterpoint.h (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCenterpoint.h 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,147 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef _TixyTaxyTorxyCenterpoint_H__
+#define _TixyTaxyTorxyCenterpoint_H__
+
+#include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h"
+
+#include <string>
+#include <util/Math.h>
+#include "TixyTaxyTorxyTower.h"
+#include "worldentities/MobileEntity.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ See TixyTaxyTorxy
+TixyTaxyTorxyReadme.txt for Information.
+ @ingroup TixyTaxyTorxy
+TixyTaxyTorxy
+ */
+ class _TixyTaxyTorxyExport TixyTaxyTorxyCenterpoint : public MobileEntity
+ {
+ public:
+ TixyTaxyTorxyCenterpoint(Context* context);
+ virtual ~TixyTaxyTorxyCenterpoint() {}
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+ /**
+ @brief The width and hight in number of tiles. Default is 15 for both.
+ */
+ void setWidth(unsigned int width)
+ { this->width_ = width; }
+ unsigned int getWidth(void) const
+ { return this->width_; }
+ void setHeight(unsigned int height)
+ { this->height_ = height; }
+ unsigned int getHeight(void) const
+ { return this->height_; }
+ void setFields(const std::string& newFields)
+ { this->fields_ = newFields; trimString(&fields_); }
+ const std::string& getFields() const
+ { return this->fields_; }
+ void setSelecterTemplate(const std::string& newTemplate)
+ { this->selecterTemplate_ = newTemplate; }
+ const std::string& getSelecterTemplate() const
+ { return this->selecterTemplate_; }
+
+ void setTower1Template(const std::string& newTemplate)
+ { this->towerTemplates_[0] = newTemplate;}
+ const std::string& getTower1Template() const
+ { return this->towerTemplates_[0]; }
+ void setTower2Template(const std::string& newTemplate)
+ { this->towerTemplates_[1] = newTemplate; }
+ const std::string& getTower2Template() const
+ { return this->towerTemplates_[1]; }
+ void setTower3Template(const std::string& newTemplate)
+ { this->towerTemplates_[2] = newTemplate; }
+ const std::string& getTower3Template() const
+ { return this->towerTemplates_[2]; }
+ void setTower4Template(const std::string& newTemplate)
+ { this->towerTemplates_[3] = newTemplate; }
+ const std::string& getTower4Template() const
+ { return this->towerTemplates_[3]; }
+ void setTower5Template(const std::string& newTemplate)
+ { this->towerTemplates_[4] = newTemplate; }
+ const std::string& getTower5Template() const
+ { return this->towerTemplates_[4]; }
+
+ void setTower1Cost(const int& newCost)
+ { this->towerCosts_[0] = newCost;}
+ const int& getTower1Cost() const
+ { return this->towerCosts_[0]; }
+ void setTower2Cost(const int& newCost)
+ { this->towerCosts_[1] = newCost; }
+ const int& getTower2Cost() const
+ { return this->towerCosts_[1]; }
+ void setTower3Cost(const int& newCost)
+ { this->towerCosts_[2] = newCost; }
+ const int& getTower3Cost() const
+ { return this->towerCosts_[2]; }
+ void setTower4Cost(const int& newCost)
+ { this->towerCosts_[3] = newCost; }
+ const int& getTower4Cost() const
+ { return this->towerCosts_[3]; }
+ void setTower5Cost(const int& newCost)
+ { this->towerCosts_[4] = newCost; }
+ const int& getTower5Cost() const
+ { return this->towerCosts_[4]; }
+
+ const int getTowerCost(int upgrade) const;
+
+
+ /**
+ @brief How to convert to world coordinates, e.g. that 0,15 is not at -8,-8 but at -80,-80 (if scale would be 10)
+ */
+ void setTileScale(unsigned int tileScale)
+ { this->tileScale_ = tileScale; }
+
+ unsigned int getTileScale(void) const
+ { return this->tileScale_; }
+
+ private:
+ void checkGametype();
+ void trimString(std::string*);
+ std::string selecterTemplate_;
+ std::string towerTemplates_[5];
+ int towerCosts_[5];
+ std::string fields_;
+ unsigned int width_;
+ unsigned int height_;
+ unsigned int tileScale_;
+ };
+}
+
+#endif /* _TixyTaxyTorxy
+TixyTaxyTorxyCenterpoint_H__ */
+
+
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCoordinate.cc
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCoordinate.cc (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCoordinate.cc 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,75 @@
+#include "TixyTaxyTorxyCoordinate.h"
+
+#include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h"
+
+
+
+
+namespace orxonox
+{
+ /**
+ @brief
+ Constructor. Sets the default coordinates: (0,0)
+ */
+ TixyTaxyTorxyCoordinate::TixyTaxyTorxyCoordinate()
+ {
+ Set(0,0);
+ }
+
+ TixyTaxyTorxyCoordinate::TixyTaxyTorxyCoordinate(int x, int y)
+ {
+ Set(x,y);
+ }
+
+ void TixyTaxyTorxyCoordinate::Set(int x, int y)
+ {
+ if (x < 0)
+ {
+ _x = 0;
+ }
+ else if (x > 15)
+ {
+ _x = 15;
+ }
+ else
+ {
+ _x = x;
+ }
+
+ if (y < 0)
+ {
+ _y = 0;
+ }
+ else if (y > 15)
+ {
+ _y = 15;
+ }
+ else
+ {
+ _y = y;
+ }
+ }
+
+ int TixyTaxyTorxyCoordinate::GetX()
+ {
+ return _x;
+ }
+
+ int TixyTaxyTorxyCoordinate::GetY()
+ {
+ return _y;
+ }
+
+
+ Vector3 TixyTaxyTorxyCoordinate::get3dcoordinate()
+ {
+ float tileScale = 100;
+
+ Vector3 coord;
+ coord.x= (_x-8) * tileScale;
+ coord.y= (_y-8) * tileScale;
+ coord.z=0;
+
+ return coord;
+ }
+}
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCoordinate.h
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCoordinate.h (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyCoordinate.h 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,32 @@
+#ifndef _TixyTaxyTorxyCoordinate_H__
+#define _TixyTaxyTorxyCoordinate_H__
+
+#include "core/CoreIncludes.h"
+#include "TixyTaxyTorxyCoordinate.h"
+#include "gametypes/Deathmatch.h"
+#include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h"
+#include "worldentities/pawns/SpaceShip.h"
+namespace orxonox
+{
+
+//Class to save the Coordinates in a class instead of struct
+//Convert 2d coordinates to 3d in order to set waypoints
+ class _TixyTaxyTorxyExport TixyTaxyTorxyCoordinate
+ {
+ public:
+ TixyTaxyTorxyCoordinate();
+ TixyTaxyTorxyCoordinate(int x, int y);
+ virtual ~TixyTaxyTorxyCoordinate() {};
+ virtual void Set(int x, int y);
+ virtual int GetX();
+ virtual int GetY();
+ virtual Vector3 get3dcoordinate();
+
+ private:
+ int _x;
+ int _y;
+ };
+
+}
+
+#endif /* _TixyTaxyTorxyCoordinate_H__ */
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.cc
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.cc (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.cc 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,331 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TixyTaxyTorxy
+TixyTaxyTorxyField.cc
+ @brief Implementation of the TixyTaxyTorxy
+TixyTaxyTorxyField class.
+*/
+
+#include "TixyTaxyTorxyField.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "TixyTaxyTorxy.h"
+
+namespace orxonox
+{
+ RegisterClass(TixyTaxyTorxyField);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object and checks whether the gametype is actually TixyTaxyTorxy
+TixyTaxyTorxy.
+ */
+TixyTaxyTorxyField::TixyTaxyTorxyField(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(TixyTaxyTorxyField);
+
+ tower_ = nullptr;
+ type_ = TixyTaxyTorxyFieldType::FREE;
+ center_ = nullptr;
+ upgrade_ = 0;
+ setPosition(0,0,0);
+ modelGround_ = new Model(getContext());
+ modelGround_->setScale(25);
+ modelGround_->pitch(Degree(90));
+ attach(modelGround_);
+ modelObject_ = new Model(getContext());
+ modelObject_->setScale(25);
+ modelObject_->pitch(Degree(90));
+ attach(modelObject_);
+ setAngle(0);
+ }
+
+ /**
+ @brief
+ Method to create a TixyTaxyTorxy
+TixyTaxyTorxyField through XML.
+ */
+ void TixyTaxyTorxyField::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(TixyTaxyTorxyField, XMLPort, xmlelement, mode);
+
+ //XMLPortParam(TixyTaxyTorxyField, "width", setWidth, getWidth, xmlelement, mode);
+
+ }
+
+ void TixyTaxyTorxyField::setCenterpoint(TixyTaxyTorxyCenterpoint* center)
+ {
+ center_ = center;
+ }
+
+ void TixyTaxyTorxyField::upgrade()
+ {
+ if (canUpgrade() == true)
+ {
+ destroyTower();
+ createTower(getUpgrade() + 1);
+ }
+ }
+
+ int TixyTaxyTorxyField::getUpgrade()
+ {
+ return upgrade_;
+ }
+
+ TixyTaxyTorxyFieldType TixyTaxyTorxyField::getType()
+ {
+ return type_;
+ }
+
+ void TixyTaxyTorxyField::setUpgrade(int upgrade)
+ {
+ if (upgrade < 0)
+ {
+ upgrade_ = 0;
+ }
+ else if (upgrade > 5)
+ {
+ upgrade = 5;
+ }
+ else
+ {
+ upgrade_ = upgrade;
+ }
+ }
+
+ bool TixyTaxyTorxyField::canUpgrade()
+ {
+ if (tower_ != nullptr && upgrade_ < 5)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ void TixyTaxyTorxyField::setAngle(int newAngle)
+ {
+ if (modelGround_ != nullptr)
+ {
+ switch (newAngle)
+ {
+ case 0:
+ modelGround_->yaw(Degree(0));
+ angle_ = 0;
+ break;
+ case 1:
+ modelGround_->yaw(Degree(90));
+ angle_ = 1;
+ break;
+ case 2:
+ modelGround_->yaw(Degree(180));
+ angle_ = 2;
+ break;
+ case 3:
+ modelGround_->yaw(Degree(270));
+ angle_ = 3;
+ break;
+ }
+ }
+
+ if (modelObject_ != nullptr)
+ {
+ switch (newAngle)
+ {
+ case 0:
+ modelObject_->yaw(Degree(0));
+ angle_ = 0;
+ break;
+ case 1:
+ modelObject_->yaw(Degree(90));
+ angle_ = 1;
+ break;
+ case 2:
+ modelObject_->yaw(Degree(180));
+ angle_ = 2;
+ break;
+ case 3:
+ modelObject_->yaw(Degree(270));
+ angle_ = 3;
+ break;
+ }
+ }
+
+ }
+
+ int TixyTaxyTorxyField::getAngle()
+ {
+ return angle_;
+ }
+
+ void TixyTaxyTorxyField::createFree(int orientation)
+ {
+ modelGround_->setMeshSource("TD_F1.mesh");
+ tower_ = nullptr;
+ type_ = TixyTaxyTorxyFieldType::FREE;
+ setUpgrade(0);
+ setAngle(orientation);
+ }
+
+ void TixyTaxyTorxyField::createStart(int orientation)
+ {
+ modelGround_->setMeshSource("TD_S5.mesh");
+ tower_ = nullptr;
+ type_ = TixyTaxyTorxyFieldType::START;
+ setUpgrade(0);
+ setAngle(orientation);
+ }
+
+
+ void TixyTaxyTorxyField::createEnd(int orientation)
+ {
+ modelGround_->setMeshSource("TD_S4.mesh");
+ tower_ = nullptr;
+ type_ = TixyTaxyTorxyFieldType::END;
+ setUpgrade(0);
+ setAngle(orientation);
+ }
+
+ void TixyTaxyTorxyField::createStraight(int orientation)
+ {
+ modelGround_->setMeshSource("TD_S1.mesh");
+ tower_ = nullptr;
+ type_ = TixyTaxyTorxyFieldType::STREET;
+ setUpgrade(0);
+ setAngle(orientation);
+ }
+
+ void TixyTaxyTorxyField::createRCurve(int orientation)
+ {
+ modelGround_->setMeshSource("TD_S2.mesh");
+ tower_ = nullptr;
+ type_ = TixyTaxyTorxyFieldType::STREET;
+ setUpgrade(0);
+ setAngle(orientation);
+ }
+
+ void TixyTaxyTorxyField::createLCurve(int orientation)
+ {
+ modelGround_->setMeshSource("TD_S3.mesh");
+ tower_ = nullptr;
+ type_ = TixyTaxyTorxyFieldType::STREET;
+ setUpgrade(0);
+ setAngle(orientation);
+ }
+
+ void TixyTaxyTorxyField::createObstacle(int orientation)
+ {
+ modelGround_->setMeshSource("TD_F1.mesh");
+ modelObject_->setMeshSource("TD_O1.mesh");
+ tower_ = nullptr;
+ type_ = TixyTaxyTorxyFieldType::OBSTACLE;
+ setUpgrade(0);
+ setAngle(orientation);
+ }
+
+ void TixyTaxyTorxyField::createTower(int upgrade)
+ {
+ if (tower_ == nullptr)
+ {
+ modelGround_->setMeshSource("TD_F1.mesh");
+ tower_ = new TixyTaxyTorxyTower(center_->getContext());
+ attach(tower_);
+ type_ = TixyTaxyTorxyFieldType::TOWER;
+ setUpgrade(upgrade);
+ if (upgrade_ > 0 && modelObject_ != nullptr)
+ {
+ switch (upgrade_)
+ {
+ case 1:
+ modelObject_->setMeshSource("TD_T1.mesh");
+ tower_->addTemplate(center_->getTower1Template());
+ break;
+ case 2:
+ modelObject_->setMeshSource("TD_T2.mesh");
+ tower_->addTemplate(center_->getTower2Template());
+ break;
+ case 3:
+ modelObject_->setMeshSource("TD_T3.mesh");
+ tower_->addTemplate(center_->getTower3Template());
+ break;
+ case 4:
+ modelObject_->setMeshSource("TD_T4.mesh");
+ tower_->addTemplate(center_->getTower4Template());
+ break;
+ case 5:
+ modelObject_->setMeshSource("TD_T5.mesh");
+ tower_->addTemplate(center_->getTower5Template());
+ break;
+ }
+ }
+ }
+ }
+
+ void TixyTaxyTorxyField::destroyTower()
+ {
+ if (tower_ != nullptr)
+ {
+ tower_->destroy();
+ tower_ = nullptr;
+ }
+ }
+
+ void TixyTaxyTorxyField::create(char object, char param)
+ {
+ int paramInt = atoi(¶m);
+ switch (object)
+ {
+ case 'F':
+ createFree(paramInt);
+ break;
+ case 'I':
+ createStraight(paramInt);
+ break;
+ case 'R':
+ createRCurve(paramInt);
+ break;
+ case 'L':
+ createLCurve(paramInt);
+ break;
+ case 'X':
+ createStart(paramInt);
+ break;
+ case 'O':
+ createEnd(paramInt);
+ break;
+ case 'Y':
+ createObstacle(paramInt);
+ break;
+ case 'T':
+ createTower(paramInt);
+ break;
+ }
+ }
+}
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.h
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.h (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.h 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,99 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+
+#ifndef _TixyTaxyTorxyField_H__
+#define _TixyTaxyTorxyField_H__
+
+#include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h"
+#include "TixyTaxyTorxyTower.h"
+#include "TixyTaxyTorxyCenterpoint.h"
+#include <string>
+#include "graphics/Model.h"
+#include "worldentities/MovableEntity.h"
+
+namespace orxonox
+{
+ enum class TixyTaxyTorxyFieldType
+ {
+ FREE,
+ STREET,
+ START,
+ END,
+ OBSTACLE,
+ TOWER
+ };
+
+ /**
+ @brief
+ See TixyTaxyTorxy
+TixyTaxyTorxyReadme.txt for Information.
+ @ingroup TixyTaxyTorxy
+TixyTaxyTorxy
+ */
+ class _TixyTaxyTorxyExport TixyTaxyTorxyField : public MovableEntity
+ {
+ public:
+ TixyTaxyTorxyField(Context* context);
+ virtual ~TixyTaxyTorxyField() {}
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ const bool isFree() const
+ { return type_==TixyTaxyTorxyFieldType::FREE; }
+ virtual void create(char object, char param);
+ virtual void setCenterpoint(TixyTaxyTorxyCenterpoint* center);
+ virtual void upgrade();
+ virtual int getUpgrade();
+ virtual TixyTaxyTorxyFieldType getType();
+ virtual void setUpgrade(int upgrade);
+ virtual bool canUpgrade();
+ virtual void createFree(int orientation);
+ virtual void createStart(int orientation);
+ virtual void createEnd(int orientation);
+ virtual void createStraight(int orientation);
+ virtual void createLCurve(int orientation);
+ virtual void createRCurve(int orientation);
+ virtual void createObstacle(int orientation);
+ virtual void createTower(int upgrade);
+ virtual int getAngle();
+ private:
+ virtual void setAngle(int newAngle);
+ virtual void destroyTower();
+ int angle_;
+ TixyTaxyTorxyFieldType type_;
+ Model* modelGround_;
+ Model* modelObject_;
+ TixyTaxyTorxyTower* tower_;
+ TixyTaxyTorxyCenterpoint* center_;
+ int upgrade_;
+
+ };
+}
+
+#endif /* _TixyTaxyTorxy
+TixyTaxyTorxyField_H__ */
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyHUDController.cc
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyHUDController.cc (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyHUDController.cc 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,95 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ *
+ * Co-authors:
+ * ...
+ */
+
+#include "TixyTaxyTorxyHUDController.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+ RegisterClass(TixyTaxyTorxyHUDController);
+
+ TixyTaxyTorxyHUDController::TixyTaxyTorxyHUDController(Context* context) : OverlayText(context)
+ {
+ RegisterObject(TixyTaxyTorxyHUDController);
+ this->tixyTaxyTorxy = nullptr;
+ }
+
+ TixyTaxyTorxyHUDController::~TixyTaxyTorxyHUDController()
+ {
+
+ }
+
+ void TixyTaxyTorxyHUDController::tick(float dt)
+ {
+ SUPER(TixyTaxyTorxyHUDController, tick, dt);
+
+ const std::string& lifes = multi_cast<std::string>(this->tixyTaxyTorxy->getLifes());
+ const std::string& credits = multi_cast<std::string>(this->tixyTaxyTorxy->getCredit());
+ const std::string& wave = multi_cast<std::string>(this->tixyTaxyTorxy->getWaveNumber());
+
+ if(showlives == true)
+ {
+ this->setCaption(multi_cast<std::string>(lifes));
+ }
+ else if(showcredits == true)
+ {
+ this->setCaption(multi_cast<std::string>(credits));
+ }
+ else if(showwaves == true)
+ {
+ this->setCaption(multi_cast<std::string>(wave));
+ }
+ }
+
+ void TixyTaxyTorxyHUDController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(TixyTaxyTorxyHUDController, XMLPort, xmlelement, mode);
+
+ XMLPortParam(TixyTaxyTorxyHUDController, "showlives", setShowlives, getShowlives, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyHUDController, "showcredits", setShowcredits, getShowcredits, xmlelement, mode);
+ XMLPortParam(TixyTaxyTorxyHUDController, "showwaves", setShowwaves, getShowwaves, xmlelement, mode);
+
+ }
+
+ void TixyTaxyTorxyHUDController::changedOwner()
+ {
+ SUPER(TixyTaxyTorxyHUDController, changedOwner);
+
+ if (this->getOwner() && this->getOwner()->getGametype())
+ {
+ this->tixyTaxyTorxy = orxonox_cast<TixyTaxyTorxy*>(this->getOwner()->getGametype());
+ }
+ else
+ {
+ this->tixyTaxyTorxy = nullptr;
+ }
+ }
+ }
+
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyHUDController.h
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyHUDController.h (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyHUDController.h 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,81 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ *
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef _TixyTaxyTorxyHUDController_H__
+#define _TixyTaxyTorxyHUDController_H__
+
+#include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h"
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+#include "TixyTaxyTorxy.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ This subclass of OverlayText is used to display the stats of the player in the HUD
+
+ @ingroup TixyTaxyTorxy
+TixyTaxyTorxy
+ */
+ class _TixyTaxyTorxyExport TixyTaxyTorxyHUDController : public OverlayText, public Tickable
+ {
+ public:
+ TixyTaxyTorxyHUDController(Context* context);
+ virtual ~TixyTaxyTorxyHUDController();
+
+
+ virtual void tick(float dt) override;
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ virtual void changedOwner() override;
+ void setShowlives(bool temp)
+ { this->showlives = temp; }
+ unsigned int getShowlives(void) const
+ { return this->showlives; }
+
+ void setShowcredits(bool temp)
+ { this->showcredits = temp; }
+ unsigned int getShowcredits(void) const
+ { return this->showcredits; }
+
+ void setShowwaves(bool temp)
+ { this->showwaves = temp; }
+ unsigned int getShowwaves(void) const
+ { return this->showwaves; }
+
+ private:
+ TixyTaxyTorxy* tixyTaxyTorxy;
+ bool showcredits;
+ bool showlives;
+ bool showwaves;
+ };
+}
+
+#endif /* _TixyTaxyTorxy
+TixyTaxyTorxyHUDController_H__ */
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,81 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the TixyTaxyTorxy
+TixyTaxyTorxy module
+*/
+
+#ifndef _TixyTaxyTorxyPrereqs_H__
+#define _TixyTaxyTorxyPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(TixyTaxyTorxy_STATIC_BUILD)
+# ifdef TixyTaxyTorxy_SHARED_BUILD
+# define _TixyTaxyTorxyExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _TixyTaxyTorxyExport
+# else
+# define _TixyTaxyTorxyExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _TixyTaxyTorxyExport __attribute__ ((visibility("default")))
+#else
+# define _TixyTaxyTorxyExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class TixyTaxyTorxy;
+
+ class TixyTaxyTorxy;
+
+ class TixyTaxyTorxyCenterpoint;
+ class TixyTaxyTorxyHUDController;
+ class TixyTaxyTorxyPlayerStats;
+ class TixyTaxyTorxyCoordinate;
+ class TowerTurret;
+ class TixyTaxyTorxyTower;
+}
+
+#endif /* _TixyTaxyTorxy
+TixyTaxyTorxyPrereqs_H__ */
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxySelecter.cc
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxySelecter.cc (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxySelecter.cc 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,181 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TixyTaxyTorxy
+TixyTaxyTorxySelecter.cc
+ @brief This class represents your figure when you play the minigame. Here the movement of the figure, activating items, ... are handled.
+*/
+
+#include "TixyTaxyTorxySelecter.h"
+
+#include "core/CoreIncludes.h"
+#include "graphics/Model.h"
+
+namespace orxonox
+{
+ RegisterClass(TixyTaxyTorxySelecter);
+
+ TixyTaxyTorxySelecter::TixyTaxyTorxySelecter(Context* context) : ControllableEntity(context)
+ {
+ RegisterObject(TixyTaxyTorxySelecter);
+
+ // initialize variables
+ moveUpPressed_ = false;
+ moveDownPressed_ = false;
+ moveLeftPressed_ = false;
+ moveRightPressed_ = false;
+ boostPressed_ = false;
+ buildTower_ = false;
+ setSelectedPosition(0,0);
+ }
+
+ TixyTaxyTorxySelecter::~TixyTaxyTorxySelecter()
+ {
+
+ }
+
+ void TixyTaxyTorxySelecter::tick(float dt)
+ {
+ SUPER(TixyTaxyTorxySelecter, tick, dt);
+
+ time_ += dt;
+
+ if (hasLocalController() && time_ >= 0.25)
+ {
+ time_ = 0;
+
+ int selecterPosX = selectedPos_->GetX();
+ int selecterPosY = selectedPos_->GetY();
+
+ if (moveUpPressed_ == true)
+ {
+ moveUpPressed_ = false;
+ selectedPos_->Set(selecterPosX, selecterPosY + 1);
+ updatePosition();
+ }
+ if (moveDownPressed_ == true)
+ {
+ moveDownPressed_ = false;
+ selectedPos_->Set(selecterPosX, selecterPosY - 1);
+ updatePosition();
+ }
+ if (moveLeftPressed_ == true)
+ {
+ moveLeftPressed_ = false;
+ selectedPos_->Set(selecterPosX - 1, selecterPosY);
+ updatePosition();
+ }
+ if (moveRightPressed_ == true)
+ {
+ moveRightPressed_ = false;
+ selectedPos_->Set(selecterPosX + 1, selecterPosY);
+ updatePosition();
+ }
+ if (boostPressed_ == true)
+ {
+ boostPressed_ = false;
+ buildTower_ = true;
+ }
+ }
+ }
+
+
+ void TixyTaxyTorxySelecter::moveFrontBack(const Vector2& value)
+ {
+ if (value.x > 0)
+ {
+ moveUpPressed_ = true;
+ moveDownPressed_ = false;
+ }
+ else
+ {
+ moveUpPressed_ = false;
+ moveDownPressed_ = true;
+ }
+ }
+
+ void TixyTaxyTorxySelecter::moveRightLeft(const Vector2& value)
+ {
+ if (value.x > 0)
+ {
+ moveLeftPressed_ = false;
+ moveRightPressed_ = true;
+ }
+ else
+ {
+ moveLeftPressed_ = true;
+ moveRightPressed_ = false;
+ }
+ }
+
+ void TixyTaxyTorxySelecter::rotateYaw(const Vector2& value)
+ {
+ }
+
+ void TixyTaxyTorxySelecter::rotatePitch(const Vector2& value)
+ {
+ }
+
+ void TixyTaxyTorxySelecter::rotateRoll(const Vector2& value)
+ {
+ }
+
+ void TixyTaxyTorxySelecter::fire(unsigned int firemode)
+ {
+ }
+
+ void TixyTaxyTorxySelecter::fired(unsigned int firemode)
+ {
+
+ }
+
+ void TixyTaxyTorxySelecter::boost(bool bBoost)
+ {
+ if (bBoost == true)
+ {
+ boostPressed_ = true;
+ }
+ }
+
+ void TixyTaxyTorxySelecter::updatePosition()
+ {
+ setPosition(selectedPos_->get3dcoordinate());
+ }
+
+ void TixyTaxyTorxySelecter::setSelectedPosition(TixyTaxyTorxyCoordinate* newPos)
+ {
+ selectedPos_ = newPos;
+ updatePosition();
+ }
+
+ void TixyTaxyTorxySelecter::setSelectedPosition(int x, int y)
+ {
+ setSelectedPosition(new TixyTaxyTorxyCoordinate(x,y));
+ }
+}
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxySelecter.h
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxySelecter.h (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxySelecter.h 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,69 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _TixyTaxyTorxySelecter_H__
+#define _TixyTaxyTorxySelecter_H__
+
+#include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h"
+#include "worldentities/ControllableEntity.h"
+#include "TixyTaxyTorxyCoordinate.h"
+
+namespace orxonox
+{
+class _TixyTaxyTorxyExport TixyTaxyTorxySelecter : public ControllableEntity
+ {
+ public:
+ TixyTaxyTorxySelecter(Context* context); //!< Constructor. Registers and initializes the object.
+ virtual ~TixyTaxyTorxySelecter();
+ virtual void tick(float dt) override;
+ virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down.
+ virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down.
+ virtual void rotateYaw(const Vector2& value) override;
+ virtual void rotatePitch(const Vector2& value) override;
+ virtual void rotateRoll(const Vector2& value) override;
+ void fire(unsigned int firemode);
+ virtual void fired(unsigned int firemode) override;
+ virtual void boost(bool bBoost) override;
+ virtual void setSelectedPosition(TixyTaxyTorxyCoordinate* newPos);
+ virtual void setSelectedPosition(int x, int y);
+
+ bool buildTower_;
+ TixyTaxyTorxyCoordinate* selectedPos_;
+ private:
+ virtual void updatePosition();
+ float time_;
+ bool moveUpPressed_;
+ bool moveDownPressed_;
+ bool moveLeftPressed_;
+ bool moveRightPressed_;
+ bool boostPressed_;
+ };
+}
+
+#endif /* _TixyTaxyTorxy
+TixyTaxyTorxySelecter_H__ */
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.cc
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.cc (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.cc 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,142 @@
+//
+// TixyTaxyTorxyTower.cc
+// Orxonox
+//
+// Created by Fabian Mentzer on 29.04.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+/* Not implemented fully */
+
+#include "TixyTaxyTorxy.h"
+
+#include "core/CoreIncludes.h"
+//#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(TixyTaxyTorxyTower);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ TixyTaxyTorxyTower::TixyTaxyTorxyTower(Context* context) : Turret(context)
+ {
+ RegisterObject(TixyTaxyTorxyTower);
+ game_ =nullptr;
+ this->setCollisionType(WorldEntity::CollisionType::None);
+ upgrade = 1;
+
+ //this->removeAllEngines();
+
+ /*
+ this->size_ = 10.0f;
+ this->delay_ = false;
+ this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
+ */
+ }
+
+ /*
+ void TixyTaxyTorxy
+TixyTaxyTorxyTower::setOrientation(const Quaternion& orientation)
+ {
+ }
+
+ void TixyTaxyTorxy
+TixyTaxyTorxyTower::rotateYaw(const Vector2& value)
+ {
+ }
+
+ void TixyTaxyTorxy
+TixyTaxyTorxyTower::rotatePitch(const Vector2& value)
+ {
+ }
+
+ void TixyTaxyTorxy
+TixyTaxyTorxyTower::rotateRoll(const Vector2& value)
+ {
+ }
+ */
+
+ bool TixyTaxyTorxyTower::upgradeTower()
+ {
+ if(upgrade < 5)
+ {
+ upgrade++;
+ this->setDamageMultiplier((upgrade+1)*2.0f);
+
+ //this->setRotationThrust(2*this->getRotationThrust());
+ //this->addTemplate("towerturret1");
+ }
+ else
+ {
+ orxout() << "Tower fully upgraded" << endl;
+ return false;
+ }
+ return true;
+ }
+
+ // This function is called whenever a player presses the up or the down key.
+ // You have to implement what happens when the up or the down key is pressed.
+ // value.x < 0 means: down key is pressed.
+ // I suggest to create a new class which is a controllable entity I will refer to as "TixyTaxyTorxy". This is the controllable entity that the
+ // player controls in order to move the TixyTaxyTorxy
+//TixyTaxyTorxyTower along the centerpoint and in order to place the TixyTaxyTorxy
+//TixyTaxyTorxyTower at the appropriate position.
+ //
+
+ // The TixyTaxyTorxy
+//TixyTaxyTorxyTower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
+ //(don't forget to set the team_ parameter such that all TixyTaxyTorxy
+//TixyTaxyTorxyTower are in the same team)
+
+ //How to move a TixyTaxyTorxy
+//TixyTaxyTorxyTower: simply attach the TixyTaxyTorxy
+//TixyTaxyTorxyTower to the TixyTaxyTorxy
+//TixyTaxyTorxyTowerMover
+ //How to place a TixyTaxyTorxy
+//TixyTaxyTorxyTower: detach the TixyTaxyTorxy
+//TixyTaxyTorxyTower from the TixyTaxyTorxy
+//TixyTaxyTorxyTowerMover
+
+ /**
+ @brief
+ Overloaded the function to rotate the stone.
+ @param value
+ A vector whose first component is the angle by which to rotate.
+ */
+ /*
+ void TixyTaxyTorxy
+TixyTaxyTorxyTower::moveFrontBack(const Vector2& value)
+ {
+ //orxout() << "frontBack.x: " << value.x << endl;
+ }
+ */
+
+ /**
+ @brief
+ Overloaded the function to steer the stone right and left
+ @param value
+ A vector whose first component is the direction in which we want to steer the stone.
+ */
+ /*
+ void TixyTaxyTorxy
+TixyTaxyTorxyTower::moveRightLeft(const Vector2& value)
+ {
+ //orxout() << "rightLeft.x: " << value.x << endl;
+
+ if(!this->delay_)
+ {
+ const Vector3& position = this->getPosition();
+ Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
+ if(!this->tetris_->isValidMove(this, newPos))
+ return;
+
+ this->setPosition(newPos);
+ this->delay_ = true;
+ this->delayTimer_.startTimer();
+ }
+ }
+ */
+}
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.h
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.h (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.h 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,60 @@
+//
+// TixyTaxyTorxyTower.h
+// Orxonox
+//
+// Created by Fabian Mentzer on 29.04.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+
+#ifndef Orxonox_TixyTaxyTorxyTower_h
+#define Orxonox_TixyTaxyTorxyTower_h
+
+#include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h"
+#include "objects/Turret.h"
+
+
+namespace orxonox
+{
+ /**
+ @brief
+ See TixyTaxyTorxy
+TixyTaxyTorxyTixyTaxyTorxy
+TixyTaxyTorxyReadme.txt for Information.
+
+ @ingroup TixyTaxyTorxy
+TixyTaxyTorxyTixyTaxyTorxy
+TixyTaxyTorxy
+ */
+ class _TixyTaxyTorxyExport TixyTaxyTorxyTower : public Turret
+ {
+ public:
+ TixyTaxyTorxyTower(Context* context);
+ virtual ~TixyTaxyTorxyTower() {};
+
+ // Maybe later override these to move TixyTaxyTorxy
+//TixyTaxyTorxyTowers with cursor keys
+ /*
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+ */
+
+ // Overriding these to stop TixyTaxyTorxy
+//TixyTaxyTorxyTowers from spasing out
+ //void setOrientation(const Quaternion& orientation);
+ //virtual void rotateYaw(const Vector2& value);
+ //virtual void rotatePitch(const Vector2& value);
+ //virtual void rotateRoll(const Vector2& value);
+ virtual bool upgradeTower();
+
+
+ void setGame(TixyTaxyTorxy* TixyTaxyTorxy)
+ { assert(TixyTaxyTorxy); game_ = TixyTaxyTorxy; }
+ private:
+ TixyTaxyTorxy* game_;
+ int upgrade;
+ };
+}
+
+
+#endif
Added: code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyreadme.txt
===================================================================
--- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyreadme.txt (rev 0)
+++ code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyreadme.txt 2018-10-31 10:02:38 UTC (rev 12064)
@@ -0,0 +1,42 @@
+===============================================================================
+Classes
+===============================================================================
+
+TixyTaxyTorxy
+TixyTaxyTorxy:
+GameType class
+
+TixyTaxyTorxy
+TixyTaxyTorxyCenterpoint
+Centerpoint class. Store tower template
+
+Tower
+Represents a Tower
+I'm not actually sure if you have to code C++ in order to have your result. I would suggest to simply create a new spaceship template or maybe better a
+new template for a pawn. (The tower don't need to be spaceships; pawn is just fine.)
+Example for a template: /data/levels/templates/assff.oxt && /data/levels/include/weaponSettingsAssff.oxi
+@ assff.oxt: you don't need an engine (or your towers could fly away :-) and probably no Cameras. (just try what happens if you leave them out.)
+@ weaponSettingsAssff.oxi:
+<weaponslots>: location where you want to have your tower to be equiped with weapons
+<weaponsets> : if you press fire, you actually always fire a whole set of weapons. The amount of weaponsets is defined here. (I'm not 100% sure whether this explanation is right.)
+
+There are three <Weapon> tags - one for each weaponslot. Each weapon can contain several objects which you would probably
+refer to as "weapons":
+
+LightningGun: Shoots a slow, rotation, yellow "ball".
+HsW01: the default laser weapon
+SimpleRocketFire: a weak (self steering) rocket
+RocketFire: a strong rocket
+
+About your Tower's Template location - either keep it in the level or do it similarly to the Assff templates.
+(If your towers behave & look nicely, I'm quite sure others want to include them in other levels, too.)
+
+
+===============================================================================
+Other files
+===============================================================================
+
+/data/levels/TixyTaxyTorxy
+TixyTaxyTorxy.oxw
+Loads the level. In <Level>, we first create a SpawnPoint. It spawns a cylinder using the 'centerpointmark' Template, which uses the 'centerpointmarkcamera' Template to create a static camera. Then, we create an instance of TixyTaxyTorxy
+TixyTaxyTorxyCenterpoint and pass the 'towertemplate' Template, so that we can later create towers using this template. We also plase the playfield.mesh in a way that maps every field on the playfield.mesh to nice coordinates: the playfield spans as a square from -8,-8 to 8,8.
\ No newline at end of file
More information about the Orxonox-commit
mailing list