[Orxonox-commit 5518] r10181 - in code/branches/presentationHS14: . data/levels data/levels/includes data/levels/templates data/overlays src/libraries/core/input src/modules/objects src/modules/towerdefense src/orxonox/controllers src/orxonox/worldentities
maxima at orxonox.net
maxima at orxonox.net
Mon Dec 15 15:58:15 CET 2014
Author: maxima
Date: 2014-12-15 15:58:14 +0100 (Mon, 15 Dec 2014)
New Revision: 10181
Added:
code/branches/presentationHS14/data/levels/includes/weaponSettingsTurret1.oxi
code/branches/presentationHS14/data/levels/templates/enemytowerdefense.oxt
code/branches/presentationHS14/data/levels/templates/standardTurret.oxt
code/branches/presentationHS14/src/modules/objects/controllers/
code/branches/presentationHS14/src/modules/towerdefense/TDCoordinate.cc
code/branches/presentationHS14/src/modules/towerdefense/TDCoordinate.h
code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseEnemy.h
code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseTower.cc
code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseTower.h
code/branches/presentationHS14/src/modules/towerdefense/TowerTurret.cc
code/branches/presentationHS14/src/modules/towerdefense/TowerTurret.h
Modified:
code/branches/presentationHS14/
code/branches/presentationHS14/data/levels/includes/weaponSettingsTurret.oxi
code/branches/presentationHS14/data/levels/templates/tower.oxt
code/branches/presentationHS14/data/levels/towerDefense.oxw
code/branches/presentationHS14/data/levels/turretTest.oxw
code/branches/presentationHS14/data/overlays/towerdefenseHUD.oxo
code/branches/presentationHS14/src/libraries/core/input/InputManager.cc
code/branches/presentationHS14/src/modules/objects/CMakeLists.txt
code/branches/presentationHS14/src/modules/objects/Turret.cc
code/branches/presentationHS14/src/modules/objects/Turret.h
code/branches/presentationHS14/src/modules/towerdefense/CMakeLists.txt
code/branches/presentationHS14/src/modules/towerdefense/TDEnemy.h
code/branches/presentationHS14/src/modules/towerdefense/Tower.cc
code/branches/presentationHS14/src/modules/towerdefense/TowerDefense.cc
code/branches/presentationHS14/src/modules/towerdefense/TowerDefense.h
code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseController.cc
code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.cc
code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.h
code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePlayerStats.cc
code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePlayerStats.h
code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePrereqs.h
code/branches/presentationHS14/src/orxonox/controllers/ArtificialController.cc
code/branches/presentationHS14/src/orxonox/worldentities/WorldEntity.cc
Log:
towerdefenseHS14 merged.
Property changes on: code/branches/presentationHS14
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/Racingbot:9388-9513
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudHS14:10083-10170
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/keckslevelHS14:10082-10169
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/leveljoemeHS14:10087-10172
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/minigame4DHS14:10081-10178
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/sfxThilo:9691-9917
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/storymodeHS14:10085-10173
/code/branches/surfaceRace:9028-9199
/code/branches/surfaceraceHS14:10080-10175
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
/code/branches/weaponupdateHS14:10084-10179
+ /code/branches/Racingbot:9388-9513
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudHS14:10083-10170
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/keckslevelHS14:10082-10169
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/leveljoemeHS14:10087-10172
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/minigame4DHS14:10081-10178
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/sfxThilo:9691-9917
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/storymodeHS14:10085-10173
/code/branches/surfaceRace:9028-9199
/code/branches/surfaceraceHS14:10080-10175
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/towerdefenseHS14:10086-10180
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
/code/branches/weaponupdateHS14:10084-10179
Modified: code/branches/presentationHS14/data/levels/includes/weaponSettingsTurret.oxi
===================================================================
--- code/branches/presentationHS14/data/levels/includes/weaponSettingsTurret.oxi 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/data/levels/includes/weaponSettingsTurret.oxi 2014-12-15 14:58:14 UTC (rev 10181)
@@ -10,13 +10,13 @@
<DefaultWeaponmodeLink firemode=0 weaponmode=0 />
</links>
<Weapon>
- <attached>
- <Model mesh="sphere.mesh" position="3,3,-2.2" scale=0.6 />
- </attached>
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 3, 3,-2.2" />
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 3,-3,-2.2" />
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-3, 3,-2.2" />
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-3,-3,-2.2" />
+ <!-- <attached>
+ <Model mesh="sphere.mesh" position="1.7,1.7,-24.5" scale=0.6 />
+ </attached> -->
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="1.7, 1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="1.7, -1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="-1.7, 1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="-1.7, -1.7,-30" />
</Weapon>
</WeaponPack>
</weapons>
Copied: code/branches/presentationHS14/data/levels/includes/weaponSettingsTurret1.oxi (from rev 10180, code/branches/towerdefenseHS14/data/levels/includes/weaponSettingsTurret1.oxi)
===================================================================
--- code/branches/presentationHS14/data/levels/includes/weaponSettingsTurret1.oxi (rev 0)
+++ code/branches/presentationHS14/data/levels/includes/weaponSettingsTurret1.oxi 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,22 @@
+ <weaponslots>
+ <WeaponSlot position="0,0,0" />
+ </weaponslots>
+ <weaponsets>
+ <WeaponSet firemode=0 />
+ </weaponsets>
+ <weapons>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+ </links>
+ <Weapon>
+ <!-- <attached>
+ <Model mesh="sphere.mesh" position="1.7,1.7,-24.5" scale=0.6 />
+ </attached> -->
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=20 material="Flares/point_lensflare" muzzleoffset="1.7, 1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=20 material="Flares/point_lensflare" muzzleoffset="1.7, -1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=20 material="Flares/point_lensflare" muzzleoffset="-1.7, 1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=20 material="Flares/point_lensflare" muzzleoffset="-1.7, -1.7,-30" />
+ </Weapon>
+ </WeaponPack>
+ </weapons>
Copied: code/branches/presentationHS14/data/levels/templates/enemytowerdefense.oxt (from rev 10180, code/branches/towerdefenseHS14/data/levels/templates/enemytowerdefense.oxt)
===================================================================
--- code/branches/presentationHS14/data/levels/templates/enemytowerdefense.oxt (rev 0)
+++ code/branches/presentationHS14/data/levels/templates/enemytowerdefense.oxt 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,234 @@
+<Template name=enemytowerdefense1>
+ <TowerDefenseEnemy
+ hudtemplate = spaceshiphud
+ camerapositiontemplate = spaceshipassffcameras
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = 3
+ explosionchunks = 6
+
+ health = 1
+ maxhealth = 2
+ initialhealth = 1
+
+ shieldhealth = 30
+ initialshieldhealth = 30
+ maxshieldhealth = 50
+ shieldabsorption = 0.8
+ reloadrate = 1
+ reloadwaittime = 1
+
+ primaryThrust = 100
+ auxilaryThrust = 30
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 15
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+
+ explosionSound = "sounds/Explosion2.ogg"
+ >
+
+ <engines>
+ <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
+ <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine />
+ </engines>
+ <attached>
+ <Model position="0,0,0" yaw=90 pitch=90 roll=0 scale=4 mesh="assff.mesh" />
+ <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+ <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 3, 5" />
+ <BoxCollisionShape position="13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="0,0,7" halfExtents="3, 2, 2" />
+ <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" />
+ <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" />
+ </collisionShapes>
+ <controller>
+ <WaypointController accuracy=60>
+ <waypoints>
+ <!-- 1,3 10,3 10,11, 13,11 -->
+
+ <Model position="-700,-500, 150" />
+ <Model position=" 200,-500, 150" />
+
+ <Model position=" 200, 300, 150" />
+ <Model position=" 500, 300, 150" />
+ <!-- <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" /> -->
+ <Model position=" 500, 700, 150" />
+
+ </waypoints>
+ </WaypointController>
+ </controller>
+ </TowerDefenseEnemy>
+</Template>
+
+
+<Template name=enemytowerdefense2>
+ <TowerDefenseEnemy
+ hudtemplate = spaceshiphud
+ camerapositiontemplate = spaceshipassffcameras
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = 3
+ explosionchunks = 6
+
+ health = 100
+ maxhealth = 200
+ initialhealth = 100
+
+ shieldhealth = 30
+ initialshieldhealth = 30
+ maxshieldhealth = 50
+ shieldabsorption = 0.8
+ reloadrate = 1
+ reloadwaittime = 1
+
+ primaryThrust = 100
+ auxilaryThrust = 30
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 15
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+
+ explosionSound = "sounds/Explosion2.ogg"
+ >
+
+ <engines>
+ <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
+ <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine />
+ </engines>
+ <attached>
+ <Model position="0,0,0" yaw=90 pitch=90 roll=0 scale=4 mesh="JumpEnemy3.mesh" />
+ <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+ <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 3, 5" />
+ <BoxCollisionShape position="13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="0,0,7" halfExtents="3, 2, 2" />
+ <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" />
+ <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" />
+ </collisionShapes>
+ <controller>
+ <WaypointController accuracy=60>
+ <waypoints>
+ <!-- 1,3 10,3 10,11, 13,11 -->
+
+ <Model position="-700,-500, 150" />
+ <Model position=" 200,-500, 150" />
+
+ <Model position=" 200, 300, 150" />
+ <Model position=" 500, 300, 150" />
+ <!-- <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" /> -->
+ <Model position=" 500, 700, 150" />
+
+ </waypoints>
+ </WaypointController>
+ </controller>
+ </TowerDefenseEnemy>
+</Template>
+
+<Template name=enemytowerdefense3>
+ <TowerDefenseEnemy
+ hudtemplate = spaceshiphud
+ camerapositiontemplate = spaceshipassffcameras
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = 3
+ explosionchunks = 6
+
+ health = 100
+ maxhealth = 200
+ initialhealth = 100
+
+ shieldhealth = 30
+ initialshieldhealth = 30
+ maxshieldhealth = 50
+ shieldabsorption = 0.8
+ reloadrate = 1
+ reloadwaittime = 1
+
+ primaryThrust = 100
+ auxilaryThrust = 30
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 15
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+
+ explosionSound = "sounds/Explosion2.ogg"
+ >
+
+ <engines>
+ <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
+ <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine />
+ </engines>
+ <attached>
+ <Model position="0,0,0" yaw=90 pitch=90 roll=0 scale=4 mesh="JumpEnemy4.mesh" />
+ <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+ <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 3, 5" />
+ <BoxCollisionShape position="13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="0,0,7" halfExtents="3, 2, 2" />
+ <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" />
+ <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" />
+ </collisionShapes>
+ <controller>
+ <WaypointController accuracy=60>
+ <waypoints>
+ <!-- 1,3 10,3 10,11, 13,11 -->
+
+ <Model position="-700,-500, 150" />
+ <Model position=" 200,-500, 150" />
+
+ <Model position=" 200, 300, 150" />
+ <Model position=" 500, 300, 150" />
+ <!-- <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" /> -->
+ <Model position=" 500, 700, 150" />
+
+ </waypoints>
+ </WaypointController>
+ </controller>
+ </TowerDefenseEnemy>
+</Template>
\ No newline at end of file
Copied: code/branches/presentationHS14/data/levels/templates/standardTurret.oxt (from rev 10180, code/branches/towerdefenseHS14/data/levels/templates/standardTurret.oxt)
===================================================================
--- code/branches/presentationHS14/data/levels/templates/standardTurret.oxt (rev 0)
+++ code/branches/presentationHS14/data/levels/templates/standardTurret.oxt 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,40 @@
+<Template name=standardturret>
+ <Turret collisionType="dynamic">
+ <attached>
+ <Model position="0,0,0" mesh="turretSocketFront.mesh" scale3D="10,10,10" pitch=-90/>
+ <Model position="0,0,0" mesh="turretSocketIn.mesh" scale3D="10,10,10" pitch=-90/>
+ <Model position="0,0,0" mesh="turretSocketTop.mesh" scale3D="10,10,10" pitch=-90/>
+ <Model position="0,0,0" mesh="turretSocketLeft.mesh" scale3D="10,10,10" pitch=-90/>
+ <Model position="0,0,0" mesh="turretSocketRight.mesh" scale3D="10,10,10" pitch=-90/>
+
+ <Turret position="0,0,-10" collisionType="dynamic" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=2000 minAttackRadius=30>
+ <attached>
+ <Model position="0,0,0" pitch="-90" roll="0" mesh="turretHead.mesh" scale3D="10,10,10"/>
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="10" position = "0,0,0"/>
+ </collisionShapes>
+ <controller>
+ <TurretController/>
+ </controller>
+ <?lua
+ include("../includes/weaponSettingsTurret.oxi")
+ ?>
+ </Turret>
+ </attached>
+
+ <controller>
+ <TeamTargetProxy/>
+ </controller>
+ </Turret>
+</Template>
+
+<Template name=spaceshipturretcameras defaults=0>
+ <SpaceShip>
+ <camerapositions>
+ <CameraPosition position="0,10, 40" drag=true mouselook=true />
+ <CameraPosition position="0,20, 80" drag=true mouselook=true />
+ <CameraPosition position="0,30,120" drag=true mouselook=true />
+ </camerapositions>
+ </SpaceShip>
+</Template>
\ No newline at end of file
Modified: code/branches/presentationHS14/data/levels/templates/tower.oxt
===================================================================
--- code/branches/presentationHS14/data/levels/templates/tower.oxt 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/data/levels/templates/tower.oxt 2014-12-15 14:58:14 UTC (rev 10181)
@@ -1,5 +1,5 @@
<Template name=tower>
- <Tower
+ <TowerDefenseTower
explosionchunks = 6
@@ -19,10 +19,13 @@
</waypoints>
</WaypointPatrolController>
</controller>
+
<attached>
<Model position="0,0,0" scale=45 mesh="Tower.mesh" />
+
+
</attached>
<!--collisionShapes>
@@ -32,6 +35,94 @@
<?lua
include("../includes/towerWeaponSettings.oxi")
?>
- </Tower>
+ </TowerDefenseTower>
</Template>
+
+
+<Template name=towerturret>
+ <TowerDefenseTower
+
+
+ explosionchunks = 6
+
+ reloadrate = 10
+ reloadwaittime = 5
+
+ collisionType = "dynamic"
+ team = 1
+
+
+ >
+ <attached>
+
+ <Model position="0,0,0" scale=45 mesh="Tower.mesh" />
+
+ <Turret reloadrate=10 reloadwaittime=5 collisionType="dynamic" position="0,0,10" direction="0,0,1" pitch="0" yaw="0" roll="0" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=1000 minAttackRadius=30>
+
+ <controller>
+ <TurretController/>
+ </controller>
+ <?lua
+ include("../includes/weaponSettingsTurret.oxi")
+ ?>
+ </Turret>
+
+ </attached>
+
+
+
+
+ <!--collisionShapes>
+
+ </collisionShapes-->
+
+<?lua
+ include("../includes/towerWeaponSettings.oxi")
+?>
+ </TowerDefenseTower>
+</Template>
+
+
+
+<Template name=towerturret1>
+ <TowerDefenseTower
+
+
+ explosionchunks = 6
+
+ reloadrate = 10
+ reloadwaittime = 5
+
+ collisionType = "dynamic"
+ team = 1
+
+
+ >
+ <attached>
+
+
+ <Turret reloadrate=10 reloadwaittime=5 collisionType="dynamic" position="0,0,10" direction="0,0,1" pitch="0" yaw="0" roll="0" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=1000 minAttackRadius=30>
+
+ <controller>
+ <TurretController/>
+ </controller>
+ <?lua
+ include("../includes/weaponSettingsTurret1.oxi")
+ ?>
+ </Turret>
+
+ </attached>
+
+
+
+
+ <!--collisionShapes>
+
+ </collisionShapes-->
+
+<?lua
+ include("../includes/towerWeaponSettings.oxi")
+?>
+ </TowerDefenseTower>
+</Template>
\ No newline at end of file
Modified: code/branches/presentationHS14/data/levels/towerDefense.oxw
===================================================================
--- code/branches/presentationHS14/data/levels/towerDefense.oxw 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/data/levels/towerDefense.oxw 2014-12-15 14:58:14 UTC (rev 10181)
@@ -20,11 +20,13 @@
include("templates/spaceshipAssff.oxt")
include("templates/spaceshipPirate.oxt")
include("templates/tower.oxt")
+ include("templates/enemytowerdefense.oxt")
+ include("templates/standardTurret.oxt")
?>
<!-- Specify the position of the camera -->
<Template name=centerpointmarkcamera defaults=0>
- <Pawn>
+ <Pawn team=1>
<camerapositions>
<CameraPosition position="0,0,1500"/>
</camerapositions>
@@ -33,7 +35,7 @@
<!-- Loads a mesh to mark the center-->
<Template name=centerpointmark>
- <Pawn camerapositiontemplate=centerpointmarkcamera>
+ <Pawn team=1 camerapositiontemplate=centerpointmarkcamera>
<attached>
<Model position="0,0,0" mesh="cylinder.mesh" scale3D="1,1,1" /> <!-- the camera is attached to this -->
</attached>
@@ -69,33 +71,17 @@
<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"/>
<!-- Spawns the camera, attached to a crate -->
- <SpawnPoint team=0 position="0,0,0" spawnclass=Pawn pawndesign=centerpointmark />
+ <SpawnPoint team=1 position="0,0,0" spawnclass=Pawn pawndesign=centerpointmark />
<!--TeamSpawnPoint team=1 position="-7,7,4" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /-->
<!--SpawnPoint team=1 position="0,0,10" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
<!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
- <SpaceShip position="-700,-500, 100" lookat="0,0,0" scale=3 team=1 >
- <templates>
- <Template link=spaceshipassff />
- </templates>
- <controller>
- <WaypointController accuracy=60>
- <waypoints>
- <!-- 1,3 10,3 10,11, 13,11 -->
- <Model mesh="cube.mesh" scale=0 position="-700,-500, 150" />
- <Model mesh="cube.mesh" scale=0 position=" 200,-500, 150" />
- <Model mesh="cube.mesh" scale=0 position=" 200, 300, 150" />
- <Model mesh="cube.mesh" scale=0 position=" 500, 300, 150" />
- <Model mesh="cube.mesh" scale=0 position=" 500, 700, 150" />
- </waypoints>
- </WaypointController>
- </controller>
- </SpaceShip>
+
<!--invisible entity to attach towers to, since playfield is static and towers are dynamic-->
- <StaticEntity position=0,0,0>
+ <StaticEntity team =1 position=0,0,0>
<attached>
<Model position="-50,-50,0" mesh="Playfield_ME.mesh" scale=80 />
@@ -131,10 +117,10 @@
position="0,0,0"
direction="0,0,0"
collisionType=dynamic
- mass=100000>
+ mass=100000
+ team=1
+ />
- </TowerDefenseCenterpoint>
-
</Scene>
</Level>
Modified: code/branches/presentationHS14/data/levels/turretTest.oxw
===================================================================
--- code/branches/presentationHS14/data/levels/turretTest.oxw 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/data/levels/turretTest.oxw 2014-12-15 14:58:14 UTC (rev 10181)
@@ -2,7 +2,7 @@
<LevelInfo
name = "turret Test"
- description = "A level with a turret in it."
+ description = "A level to test turrets with."
tags = "test"
screenshot = "emptylevel.png"
/>
@@ -15,8 +15,7 @@
<?lua
include("templates/spaceshipAssff.oxt")
- include("templates/spaceshipPirate.oxt")
- include("templates/spaceshipTurret.oxt")
+ include("templates/standardTurret.oxt")
?>
<Level>
@@ -32,31 +31,26 @@
<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="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+<SpaceShip position = "0,0,800" collisionType="dynamic" team=10>
+ <controller>
+ <TeamTargetProxy team=10/>
+ </controller>
+ <attached>
+ <Model position="0,0,0" mesh="plane.mesh" scale3D="20,20,20" pitch=-90/>
-<StaticEntity position="0,0,0" yaw=0 pitch=0>
- <attached>
- <Model position="0,0,0" mesh="turretSocketFront.mesh" scale3D="10,10,10" />
- <Model position="0,0,0" mesh="turretSocketIn.mesh" scale3D="10,10,10" />
- <Model position="0,0,0" mesh="turretSocketTop.mesh" scale3D="10,10,10" />
- <Model position="0,0,0" mesh="turretSocketLeft.mesh" scale3D="10,10,10" />
- <Model position="0,0,0" mesh="turretSocketRight.mesh" scale3D="10,10,10" />
- </attached>
-</StaticEntity>
+ <?lua for i = 1, 10, 1 do ?>
+ <Turret position="<?lua print(150-i*30) ?>,<?lua print(150-i*30) ?>,0" pitch="0" yaw="0" roll="0">
+ <templates>
+ <Template link=standardturret />
+ </templates>
+ </Turret>
+ <?lua end ?>
-
-
-<Turret position="0,10,0" pitch="90" yaw="0" roll="0">
- <templates>
- <Template link=spaceshipturret />
- </templates>
- <controller>
- <WaypointPatrolController alertnessradius=100 team=10>
- </WaypointPatrolController>
- </controller>
-</Turret>
-
-
-
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape radius="10" position="0,0,0" halfExtents="200, 200, 0"/>
+ </collisionShapes>
+</SpaceShip>
</Scene>
</Level>
Modified: code/branches/presentationHS14/data/overlays/towerdefenseHUD.oxo
===================================================================
--- code/branches/presentationHS14/data/overlays/towerdefenseHUD.oxo 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/data/overlays/towerdefenseHUD.oxo 2014-12-15 14:58:14 UTC (rev 10181)
@@ -1,14 +1,82 @@
<Template name="TowerDefenseHUD">
+
+
<OverlayGroup name="TowerDefenseHUD" scale = "1, 1">
+
+
<OverlayText
- position = "0.05, 0.05"
+ 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 = "Hello World"
+ caption = "Cash:"
/>
+
+
+ <TowerDefenseHUDController
+ 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:"
+ />
+
+ <TowerDefenseHUDController
+ 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:"
+ />
+
+ <TowerDefenseHUDController
+ 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>
+
+
Modified: code/branches/presentationHS14/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/presentationHS14/src/libraries/core/input/InputManager.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/libraries/core/input/InputManager.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -174,13 +174,13 @@
paramList.insert(StringPair("XAutoRepeatOn", "true"));
if (exclusiveMouse_ || GraphicsManager::getInstance().isFullScreen())
- {
+ { // HACK MARTIN for debugging, changed values here to true
if (CommandLineParser::getValue("keyboard_no_grab").get<bool>())
paramList.insert(StringPair("x11_keyboard_grab", "false"));
else
- paramList.insert(StringPair("x11_keyboard_grab", "true"));
- paramList.insert(StringPair("x11_mouse_grab", "true"));
- paramList.insert(StringPair("x11_mouse_hide", "true"));
+ paramList.insert(StringPair("x11_keyboard_grab", "false"));
+ paramList.insert(StringPair("x11_mouse_grab", "false"));
+ paramList.insert(StringPair("x11_mouse_hide", "false"));
}
else
{
Modified: code/branches/presentationHS14/src/modules/objects/CMakeLists.txt
===================================================================
--- code/branches/presentationHS14/src/modules/objects/CMakeLists.txt 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/objects/CMakeLists.txt 2014-12-15 14:58:14 UTC (rev 10181)
@@ -10,6 +10,7 @@
ADD_SUBDIRECTORY(collisionshapes)
ADD_SUBDIRECTORY(eventsystem)
ADD_SUBDIRECTORY(triggers)
+ADD_SUBDIRECTORY(controllers)
ORXONOX_ADD_LIBRARY(objects
MODULE
Modified: code/branches/presentationHS14/src/modules/objects/Turret.cc
===================================================================
--- code/branches/presentationHS14/src/modules/objects/Turret.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/objects/Turret.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Marian Runo
+ * Marian Runo, Martin Mueller
* Co-authors:
* ...
*
@@ -28,58 +28,257 @@
#include "Turret.h"
#include "core/CoreIncludes.h"
-#include "OgreQuaternion.h"
#include "core/XMLPort.h"
-#include "controllers/WaypointPatrolController.h"
+#include "Scene.h"
+#include <OgreSceneManager.h>
+
namespace orxonox
{
RegisterClass(Turret);
+
+
/**
- * @brief Constructor
+ @brief
+ Sets default values for all variables. Also hides the turret from the radar.
+
+ @param context
+ The context
*/
- Turret::Turret(Context* context) : SpaceShip(context)
+ Turret::Turret(Context* context) : Pawn(context)
{
RegisterObject(Turret);
- this->controller_ = new WaypointPatrolController(this->getContext());
+ this->rotationThrust_ = 50;
+ this->startDir_ = Vector3::ZERO;
+ this->localZ_ = Vector3::UNIT_Z;
+ this->localY_ = Vector3::UNIT_Y;
+ this->localX_ = Vector3::UNIT_X;
+ this->maxAttackRadius_ = 200;
+ this->minAttackRadius_ = 0;
+ this->maxPitch_ = 90;
+ this->maxYaw_ = 90;
+ this->once_ = false;
+ this->rotation_ = Quaternion::IDENTITY;
+
+ this->setRadarVisibility(false);
+
+ //this->rayTest_ = this->getScene()->getSceneManager()->createRayQuery(Ogre::Ray());
}
/**
- * @brief Destructor
+ @brief
+ Destructor. Destroys the rayTest_ element (if it was used) .
*/
Turret::~Turret()
{
+ //this->getScene()->getSceneManager()->destroyQuery(this->rayTest_);
+ }
+ /**
+ @brief
+ Checks, if a WorldEntity is inside the turret's range.
+
+ This function is safe to use on turrets that are attached, rotated, etc.
+ The turret's range is determined with the maxPitch, maxYaw, and the two attackRadius.
+
+ @param target
+ The WorldEntity to check
+
+ @return
+ The squared distance to the position. -1, if it's ouside of range
+ */
+ float Turret::isInRange(const WorldEntity* target )
+ {
+ //Check distance
+ Vector3 distance = target->getWorldPosition() - this->getWorldPosition();
+ float distanceVal = distance.squaredLength();
+ if(distanceVal > (this->maxAttackRadius_ * this->maxAttackRadius_) || distanceVal < (this->minAttackRadius_ * this->minAttackRadius_))
+ {
+ return -1.f;
+ }
+
+ //Check pitch
+ Vector3 dir = getTransformedVector(distance, this->localX_, this->localY_, this->localZ_);
+ Vector3 dirProjected = dir;
+ dirProjected.x = 0;
+ Vector3 startDirProjected = this->startDir_;
+ startDirProjected.x = 0;
+ Ogre::Real angle = startDirProjected.angleBetween(dirProjected).valueDegrees();
+ if(angle > this->maxPitch_)
+ {
+ return -1.f;
+ }
+
+ //Check yaw
+ dirProjected = dir;
+ dirProjected.y = 0;
+ startDirProjected = this->startDir_;
+ startDirProjected.y = 0;
+ angle = startDirProjected.angleBetween(dirProjected).valueDegrees();
+ if(angle > this->maxYaw_)
+ {
+ return -1.f;
+ }
+
+ //TODO: Finish this. Find a way to convert objects from Ogre to Orxonox
+ /*Ogre::Ray ray = Ogre::Ray(this->getWorldPosition(), distance);
+ this->rayTest_->setRay(ray);
+ Ogre::RaySceneQueryResult result = this->rayTest_->execute();*/
+
+
+ return distanceVal;
}
+ /**
+ @brief
+ Rotates the turret to make it aim at a certain position.
- void Turret::rotatePitch(const Vector2& value)
+ @note
+ There are no checks, if the position is valid (i.e. if the turret is allowed to aim there).
+ This function must be called again for every tick, or the turret will stop rotating.
+
+ @param position
+ The position to aim at
+ */
+ void Turret::aimAtPosition(const Vector3& position)
{
- orxout()<< "Turret rotate Pitch"<< endl;
+ Vector3 currDir = this->getWorldOrientation() * WorldEntity::FRONT;
+ Vector3 targetDir = position - this->getWorldPosition();
- const Quaternion& orient = this->getOrientation();
- Radian pitch = orient.getPitch();
+ this->rotation_ = currDir.getRotationTo(targetDir);
+ }
- if((value.x > 0 && pitch < Radian(180)) || (value.x < 0 && pitch > Radian(0)))
- SpaceShip::rotatePitch(value);
+ /**
+ @brief
+ Does currently nothing.
+
+ Should rotate the turret with the specified pitch. Contains a failed attempt at limiting said rotation.
+ */
+ void Turret::rotatePitch(const Vector2& value)
+ {
+ //This is a failed attempt at limiting the turret's rotation. It's handled in the controller (for now?)
+ /*
+ Vector3 currentDir = getTransformedVector(this->getOrientation() * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
+ Vector3 currentDirProjected = currentDir;
+ currentDirProjected.x = 0;
+ Vector3 startDirProjected = this->startDir_;
+ startDirProjected.x = 0;
+ Ogre::Real angle = startDirProjected.angleBetween(currentDirProjected).valueDegrees();
+ //orxout() << "Pitch: " << angle << endl;
+ //if(angle < this->maxPitch_ || (currentDirProjected.y <= 0 && value.x > 0) || (currentDirProjected.y > 0 && value.x < 0) )
+ {
+ this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x*0.8f);
+ }
+ */
}
+ /**
+ @brief
+ Does currently nothing.
- void Turret::setAlertnessRadius(float value)
+ Should rotate the turret with the specified yaw. Contains a failed attempt at limiting said rotation.
+ */
+ void Turret::rotateYaw(const Vector2& value)
{
- this->controller_->setAlertnessRadius(value);
+ //This is a failed attempt at limiting the turret's rotation. It's handled in the controller (for now?)
+ /*
+ Vector3 currentDir = getTransformedVector(this->getOrientation() * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
+ Vector3 currentDirProjected = currentDir;
+ currentDirProjected.y = 0;
+ Vector3 startDirProjected = this->startDir_;
+ startDirProjected.y = 0;
+ Ogre::Real angle = startDirProjected.angleBetween(currentDirProjected).valueDegrees();
+ orxout() << "Yaw: " << angle << endl;
+ if(angle < this->maxYaw_ || (currentDirProjected.x <= 0 && value.x < 0) || (currentDirProjected.x > 0 && value.x > 0))
+ {
+ this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x*0.8f);
+ }
+ */
}
- float Turret::getAlertnessRadius()
+
+ /**
+ @brief
+ Does currently nothing.
+
+ May be used to limit turret's rotation in the future.
+ */
+ void Turret::rotateRoll(const Vector2& value)
{
- return this->controller_->getAlertnessRadius();
}
+ /**
+ @brief
+ Loads parameters from xml
+
+ Parameters loaded are: rotationThrust, maxAttackRadius, minAttackRadius, maxYaw, maxPitch
+ */
void Turret::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(Turret, XMLPort, xmlelement, mode);
- XMLPortParam(Turret, "alertnessRadius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues("400");
+
+ XMLPortParamVariable(Turret, "rotationThrust", rotationThrust_, xmlelement, mode);
+ XMLPortParam(Turret, "maxAttackRadius", setMaxAttackRadius, getMaxAttackRadius, xmlelement, mode);
+ XMLPortParam(Turret, "minAttackRadius", setMinAttackRadius, getMinAttackRadius, xmlelement, mode);
+ XMLPortParam(Turret, "maxYaw", setMaxYaw, getMaxYaw, xmlelement, mode);
+ XMLPortParam(Turret, "maxPitch", setMaxPitch, getMaxPitch, xmlelement, mode);
}
+ /**
+ @brief
+ The turret's actions are done here.
-}
+ Every tick, the turret gets rotated if it should, and the local axes get updated with the parent's rotation.
+
+ @param dt
+ Duration of the tick
+ */
+ void Turret::tick(float dt)
+ {
+ SUPER(Turret, tick, dt);
+
+ //Stuff isn't properly initialized in the c'tor, so we have to do it like this
+ if(!this->once_)
+ {
+ //Account for rotations done in xml
+ Quaternion startOrient = this->getOrientation();
+ this->localXStart_ = startOrient * this->localX_;
+ this->localXStart_.normalise();
+ this->localX_ = this->localXStart_;
+ this->localYStart_ = startOrient * this->localY_;
+ this->localYStart_.normalise();
+ this->localY_ = this->localYStart_;
+ this->localZStart_ = startOrient * this->localZ_;
+ this->localZStart_.normalise();
+ this->localZ_ = this->localZStart_;
+
+ //startDir should always be (0,0,-1)
+ this->startDir_ = getTransformedVector(startOrient * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
+
+ this->once_ = true;
+
+ }
+
+ //Adjust local axes to parent's rotation
+ WorldEntity* parent = this->getParent();
+ if(parent)
+ {
+ Quaternion parentrot = parent->getWorldOrientation();
+ this->localX_ = parentrot * this->localXStart_;
+ this->localY_ = parentrot * this->localYStart_;
+ this->localZ_ = parentrot * this->localZStart_;
+ }
+
+ //rotate
+ if(this->rotation_ != Quaternion::IDENTITY)
+ {
+ //Don't make the rotation instantaneous. Use an arbitrary interpolation, not that great...
+ //TODO: make the rotation better (constant velocity etc.). At the moment, the turret rotates
+ //slower the closer it is to the destination
+ Quaternion drot = Quaternion::nlerp(dt*this->rotationThrust_/20.f, Quaternion::IDENTITY, this->rotation_);
+ this->rotate(drot, WorldEntity::World);
+ this->rotation_ = Quaternion::IDENTITY;
+ }
+
+ }
+}
\ No newline at end of file
Modified: code/branches/presentationHS14/src/modules/objects/Turret.h
===================================================================
--- code/branches/presentationHS14/src/modules/objects/Turret.h 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/objects/Turret.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -20,14 +20,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Marian Runo
+ * Marian Runo, Martin Mueller
* Co-authors:
* ...
*
*/
/**
- @file Turret.h
@brief Definition of the Turret class.
@ingroup Objects
*/
@@ -36,33 +35,93 @@
#define _Turret_H__
#include "objects/ObjectsPrereqs.h"
+#include "worldentities/pawns/Pawn.h"
+#include <OgreSceneQuery.h>
-#include "worldentities/pawns/SpaceShip.h"
-
namespace orxonox
{
- class _ObjectsExport Turret : public SpaceShip
+ /**
+ @brief
+ Creates a turret with limited rotation. The point of this class is to be able to attach
+ a turret to a spaceship or a spacestation which is more or less completely autonomous in
+ it's behaviour.
+
+ This class also contains a custom local coordinate system, which gets initially rotated through xml, and
+ afterwards is updated with the parent's rotation (if there is one). This allows for almost trivialal calculation
+ of pitch, yaw and roll through coordinate transformation. (TODO: Ogre should do something like this already, investigate...)
+
+
+ @note
+ The rotation isn't limited "physically". You have to call isInRange to find out if the turret is allowed to shoot at a target.
+ */
+ class _ObjectsExport Turret : public Pawn
{
public:
Turret(Context* context);
virtual ~Turret();
- //virtual void tick(float dt);
-
virtual void rotatePitch(const Vector2& value);
+ virtual void rotateYaw(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);
+ virtual float isInRange(const WorldEntity* target);
+ virtual void aimAtPosition(const Vector3 &position);
- void setAlertnessRadius(float value);
- float getAlertnessRadius();
-
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+ /** @brief Sets the maximum distance the turret is allowed to shoot. @param radius The distance*/
+ inline void setMaxAttackRadius(float radius)
+ { this->maxAttackRadius_ = radius; }
+ /** @brief Sets the minimum distance the turret is allowed to shoot. @param radius The distance*/
+ inline void setMinAttackRadius(float radius)
+ { this->minAttackRadius_ = radius; }
+
+ /** @brief Sets the maximum pitch the turret can have (in both directions). @param pitch The pitch (in one direction)*/
+ inline void setMaxPitch(float pitch)
+ { this->maxPitch_ = pitch; }
+
+ /** @brief Sets the maximum yaw the turret can have (in both directions). @param yaw The yaw (in one direction)*/
+ inline void setMaxYaw(float yaw)
+ { this->maxYaw_ = yaw; }
+
+ /** @brief Returns the maximum distance the turret is allowed to shoot. @return The distance */
+ inline float getMaxAttackRadius() const
+ { return this->maxAttackRadius_; }
+
+ /** @brief Returns the minimum distance the turret is allowed to shoot. @return The distance */
+ inline float getMinAttackRadius() const
+ { return this->minAttackRadius_; }
+
+ /** @brief Returns the maximum pitch the turret can have. @return The pitch */
+ inline float getMaxPitch() const
+ { return this->maxPitch_; }
+
+ /** @brief Returns the maximum yaw the turret can have. @return The yaw */
+ inline float getMaxYaw() const
+ { return this->maxYaw_; }
+
protected:
- WaypointPatrolController* controller_;
+ Vector3 startDir_; //!< The initial facing direction, in local coordinates.
+ Vector3 localZ_; //!< The local z-axis, includes for the parent's rotation and rotations done in xml.
+ Vector3 localY_; //!< The local y-axis, includes for the parent's rotation and rotations done in xml.
+ Vector3 localX_; //!< The local x-axis, includes for the parent's rotation and rotations done in xml.
+ Quaternion rotation_; //!< The rotation to be done by the turret.
+
private:
+ bool once_; //!< Flag for executing code in the tick function only once.
+ Vector3 localZStart_; //!< The local z-axis, without the parent's rotation.
+ Vector3 localYStart_; //!< The local y-axis, without the parent's rotation.
+ Vector3 localXStart_; //!< The local x-axis, without the parent's rotation.
+ float maxAttackRadius_; //!< The maximum distance the turret is allowed to shoot.
+ float minAttackRadius_; //!< The minimum distance the turret is allowed to shoot.
+ Ogre::Real maxPitch_; //!< The maxmium pitch the turret can have (on one side).
+ Ogre::Real maxYaw_; //!< The maxmium yaw the turret can have (on one side).
+ float rotationThrust_; //!< The velocity the turret rotates with.
+ Ogre::RaySceneQuery* rayTest_; //!< Used to perform a raytest, currently unused @see isInRange
+
};
}
#endif
-
Modified: code/branches/presentationHS14/src/modules/towerdefense/CMakeLists.txt
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/CMakeLists.txt 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/CMakeLists.txt 2014-12-15 14:58:14 UTC (rev 10181)
@@ -1,9 +1,12 @@
SET_SOURCE_FILES(TOWERDEFENSE_SRC_FILES
TowerDefense.cc
- Tower.cc
+ TowerDefenseTower.cc
+ TowerTurret.cc
TowerDefenseCenterpoint.cc
TowerDefenseHUDController.cc
TowerDefensePlayerStats.cc
+ TDCoordinate.cc
+ TowerDefenseEnemy.cc
)
Copied: code/branches/presentationHS14/src/modules/towerdefense/TDCoordinate.cc (from rev 10180, code/branches/towerdefenseHS14/src/modules/towerdefense/TDCoordinate.cc)
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TDCoordinate.cc (rev 0)
+++ code/branches/presentationHS14/src/modules/towerdefense/TDCoordinate.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,42 @@
+#include "TDCoordinate.h"
+
+#include "towerdefense/TowerDefensePrereqs.h"
+
+
+
+
+namespace orxonox
+{
+ //RegisterClass(TDCoordinate);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ TDCoordinate::TDCoordinate()
+ {
+ //RegisterObject(TDCoordinate);
+ x=0;
+ y=0;
+
+ }
+
+ TDCoordinate::TDCoordinate(int x, int y)
+ {
+ this->x=x;
+ this->y=y;
+ }
+
+
+ Vector3 TDCoordinate::get3dcoordinate()
+ {
+ int tileScale = 100;
+
+ Vector3 *coord = new Vector3();
+ coord->x= (x-8) * tileScale;
+ coord->y= (y-8) * tileScale;
+ coord->z=100;
+
+ return *coord;
+ }
+}
Copied: code/branches/presentationHS14/src/modules/towerdefense/TDCoordinate.h (from rev 10180, code/branches/towerdefenseHS14/src/modules/towerdefense/TDCoordinate.h)
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TDCoordinate.h (rev 0)
+++ code/branches/presentationHS14/src/modules/towerdefense/TDCoordinate.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,32 @@
+#ifndef _TDCoordinate_H__
+#define _TDCoordinate_H__
+
+#include "core/CoreIncludes.h"
+#include "TDCoordinate.h"
+//#include "towerdefense/TowerDefense.h"
+#include "gametypes/Deathmatch.h"
+#include "towerdefense/TowerDefensePrereqs.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 _TowerDefenseExport TDCoordinate: public OrxonoxClass {
+public:
+ int x;
+ int y;
+
+ TDCoordinate();
+
+ Vector3 get3dcoordinate();
+
+ virtual ~TDCoordinate() {};
+
+ TDCoordinate(int x, int y);
+ };
+
+
+}
+
+#endif /* _TDCoordinate_H__ */
Modified: code/branches/presentationHS14/src/modules/towerdefense/TDEnemy.h
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TDEnemy.h 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TDEnemy.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -4,7 +4,7 @@
* Created on: Mar 30, 2012
* Author: weigeltm
*/
-
+/*
#ifndef TDENEMY_H_
#define TDENEMY_H_
@@ -23,4 +23,4 @@
};
-#endif /* TDENEMY_H_ */
+#endif TDENEMY_H_ */
Modified: code/branches/presentationHS14/src/modules/towerdefense/Tower.cc
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/Tower.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/Tower.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -39,25 +39,25 @@
void Tower::setOrientation(const Quaternion& orientation)
{
static int ori;
- orxout() << "orientation " << ++ori << endl;
+ //orxout() << "orientation " << ++ori << endl;
}
void Tower::rotateYaw(const Vector2& value)
{
static int yaw;
- orxout() << "rotateYaw " << ++yaw << endl;
+ //orxout() << "rotateYaw " << ++yaw << endl;
}
void Tower::rotatePitch(const Vector2& value)
{
static int pitch;
- orxout() << "rotatePitch " << ++pitch << endl;
+ //orxout() << "rotatePitch " << ++pitch << endl;
}
void Tower::rotateRoll(const Vector2& value)
{
static int roll;
- orxout() << "rotateRoll" << ++roll << endl;
+ //orxout() << "rotateRoll" << ++roll << endl;
}
// This function is called whenever a player presses the up or the down key.
Modified: code/branches/presentationHS14/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefense.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefense.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Author:
+ * Author:
*
* Co-authors:
* ...
@@ -72,22 +72,19 @@
*
*
*/
-
#include "TowerDefense.h"
-#include "Tower.h"
+#include "TowerDefenseTower.h"
#include "TowerDefenseCenterpoint.h"
-
+//#include "TDCoordinate.h"
+#include "TowerTurret.h"
#include "worldentities/SpawnPoint.h"
#include "worldentities/pawns/Pawn.h"
#include "worldentities/pawns/SpaceShip.h"
#include "controllers/WaypointController.h"
-
#include "graphics/Model.h"
#include "infos/PlayerInfo.h"
-
#include "chat/ChatManager.h"
#include "core/CoreIncludes.h"
-
/* Part of a temporary hack to allow the player to add towers */
#include "core/command/ConsoleCommand.h"
@@ -98,13 +95,20 @@
TowerDefense::TowerDefense(Context* context) : Deathmatch(context)
{
RegisterObject(TowerDefense);
+/*
+ for (int i=0; i < 16 ; i++){
+ for (int j = 0; j< 16 ; j++){
+ towermatrix[i][j] = NULL;
+ }
+ }*/
this->setHUDTemplate("TowerDefenseHUD");
- this->stats_ = new TowerDefensePlayerStats();
+ //this->stats_ = new TowerDefensePlayerStats();
- /* Temporary hack to allow the player to add towers */
+ /* Temporary hack to allow the player to add towers and upgrade them */
this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) );
+ this->dedicatedUpgradeTower_ = createConsoleCommand( "upgradeTower", createExecutor( createFunctor(&TowerDefense::upgradeTower, this) ) );
}
TowerDefense::~TowerDefense()
@@ -126,49 +130,136 @@
void TowerDefense::start()
{
+
Deathmatch::start();
- const int kInitialTowerCount = 3;
- Coordinate initialTowerCoordinates[kInitialTowerCount] = {{3,2}, {8,5}, {12,10}};
-
- for (int i = 0; i < kInitialTowerCount; i++)
- {
- Coordinate coordinate = initialTowerCoordinates[i];
- addTower(coordinate.x, coordinate.y);
+// Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path
+ for (int i=0; i < 16 ; i++){
+ for (int j = 0; j< 16 ; j++){
+ towermatrix[i][j] = false;
+ }
}
- ChatManager::message("Use the console command addTower x y to add towers");
+ for (int k=0; k<3; k++)
+ towermatrix[1][k]=true;
+ for (int l=1; l<11; l++)
+ towermatrix[l][3]=true;
+ for (int m=3; m<12; m++)
+ towermatrix[10][m]=true;
+ for (int n=10; n<14; n++)
+ towermatrix[n][11]=true;
+ for (int o=13; o<16; o++)
+ towermatrix[13][o]=true;
- //TODO: let the player control his controllable entity && TODO: create a new ControllableEntity for the player
+//set initial credits, lifes and WaveNumber
+ this->setCredit(200);
+ this->setLifes(50);
+ this->setWaveNumber(0);
+ time=0.0;
+
+//adds initial towers
+for (int i=0; i <7; i++){
+ addTower(i+3,4);
+ }/*
+for (int j=0; j < 7; j++){
+ addTower(9,j+5);
+ }*/
+}
+ // Generates a TowerDefenseEnemy. Uses Template "enemytowerdefense". Sets position at first waypoint of path.
+ void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr){
+
+
+ TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext());
+
+ switch(templatenr)
+ {
+ case 1 :
+ en1->addTemplate("enemytowerdefense1");
+ en1->setScale(3);
+ en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
+
+ break;
+ case 2 :
+ en1->addTemplate("enemytowerdefense2");
+ en1->setScale(2);
+ en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
+ // en1->setShieldHealth(en1->getShield() = this->getWaveNumber()*2))
+
+ break;
+ case 3 :
+ en1->addTemplate("enemytowerdefense3");
+ en1->setScale(1);
+ en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
+ break;
+ }
+
+ en1->getController();
+ en1->setPosition(path.at(0)->get3dcoordinate());
+ TowerDefenseEnemyvector.push_back(en1);
+
+ for(unsigned int i = 0; i < path.size(); ++i)
+ {
+ en1->addWaypoint((path.at(i)));
+ }
}
+
void TowerDefense::end()
+
{
+
Deathmatch::end();
+ ChatManager::message("Match is over! Gameover!");
- ChatManager::message("Match is over");
}
+ //not working yet
+ void TowerDefense::upgradeTower(int x,int y)
+ {/*
+ const int upgradeCost = 20;
+
+ if (!this->hasEnoughCreditForTower(upgradeCost))
+ {
+ orxout() << "not enough credit: " << (this->getCredit()) << " available, " << upgradeCost << " needed.";
+ return;
+ }
+
+ if (towermatrix [x][y] == NULL)
+ {
+ orxout() << "no tower on this position" << endl;
+ return;
+ }
+
+ else
+ {
+ (towermatrix [x][y])->upgradeTower();
+ }*/
+ }
+
+ /*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 TowerDefense::addTower(int x, int y)
{
- const TowerCost towerCost = TDDefaultTowerCost;
+ const int towerCost = 20;
if (!this->hasEnoughCreditForTower(towerCost))
{
- orxout() << "not enough credit: " << (this->stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed.";
+ orxout() << "not enough credit: " << (this->getCredit()) << " available, " << towerCost << " needed.";
return;
}
- if (this->towerExists(x,y))
+ if (towermatrix [x][y]==true)
{
- orxout() << "tower exists!!" << endl;
+ orxout() << "not possible to put tower here!!" << endl;
return;
}
- /*
+/*
unsigned int width = this->center_->getWidth();
unsigned int height = this->center_->getHeight();
- */
+*/
int tileScale = (int) this->center_->getTileScale();
@@ -181,42 +272,89 @@
orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
- // Add tower to coordinatesStack
- Coordinate newTowerCoordinates = {x, y};
- addedTowersCoordinates_.push_back(newTowerCoordinates);
+ //Reduce credit
+ this->buyTower(towerCost);
+ towermatrix [x][y]=true;
- // Reduce credit
- this->stats_->buyTower(towerCost);
+ //Creates tower
+ TowerDefenseTower* towernew = new TowerDefenseTower(this->center_->getContext());
+ towernew->addTemplate("towerturret");
+ towernew->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
+ towernew->setGame(this);
+ }
- // Create tower
- Tower* newTower = new Tower(this->center_->getContext());
- newTower->addTemplate(this->center_->getTowerTemplate());
-
- newTower->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
- newTower->setGame(this);
+ bool TowerDefense::hasEnoughCreditForTower(int towerCost)
+ {
+ return ((this->getCredit()) >= towerCost);
}
- bool TowerDefense::hasEnoughCreditForTower(TowerCost towerCost)
+
+ bool TowerDefense::hasEnoughCreditForUpgrade()
{
- return ((this->stats_->getCredit()) >= towerCost);
+ return true;
}
- bool TowerDefense::towerExists(int x, int y)
+
+ void TowerDefense::tick(float dt)
{
- for(std::vector<Coordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it)
+ SUPER(TowerDefense, tick, dt);
+ time +=dt;
+
+ TDCoordinate* coord1 = new TDCoordinate(1,1);
+ std::vector<TDCoordinate*> path;
+ path.push_back(coord1);
+ if(time>1 && TowerDefenseEnemyvector.size() < 30)
{
- Coordinate currentCoordinates = (Coordinate) (*it);
- if (currentCoordinates.x == x && currentCoordinates.y == y)
- return true;
+ //adds different types of enemys depending on the WaveNumber
+ addTowerDefenseEnemy(path, this->getWaveNumber() % 3 +1 );
+ time = time-1;
}
- return false;
- }
+ Vector3* endpoint = new Vector3(500, 700, 150);
+ //if ships are at the end they get destroyed
+ for(unsigned int i =0; i < TowerDefenseEnemyvector.size(); ++i)
+ {
+ if(TowerDefenseEnemyvector.at(i) != NULL && TowerDefenseEnemyvector.at(i)->isAlive())
+ {
+ //destroys enemys at the end of teh path and reduces the life by 1. no credits gifted
+ Vector3 ship = TowerDefenseEnemyvector.at(i)->getRVWorldPosition();
+ float distance = ship.distance(*endpoint);
- void TowerDefense::tick(float dt)
- {
- SUPER(TowerDefense, tick, dt);
+ if(distance <50){
+ TowerDefenseEnemyvector.at(i)->destroy();
+ this->reduceLifes(1);
+ this->buyTower(1);
+ if (this->getLifes()==0)
+ {
+ this->end();
+ }
+ }
+ }
+ }
+ //goes thorugh vector to see if an enemy is still alive. if not next wave is launched
+ int count= 0;
+ for(unsigned int i =0; i < TowerDefenseEnemyvector.size(); ++i)
+ {
+ if(TowerDefenseEnemyvector.at(i)!= NULL)
+ {
+ ++count;
+ }
+ }
+
+ if(count== 0)
+ {
+ time2 +=dt;
+ if(time2 > 10)
+ {
+ TowerDefenseEnemyvector.clear();
+ this->nextwave();
+ time=0;
+ time2=0;
+ }
+ }
+
+
}
// Function to test if we can add waypoints using code only. Doesn't work yet
Modified: code/branches/presentationHS14/src/modules/towerdefense/TowerDefense.h
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefense.h 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefense.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -36,12 +36,13 @@
#ifndef _TowerDefense_H__
#define _TowerDefense_H__
-
+#include "TDCoordinate.h"
#include "towerdefense/TowerDefensePrereqs.h"
#include "gametypes/Deathmatch.h"
+#include "TowerDefenseEnemy.h"
+#include "util/Output.h"
+#include "core/object/WeakPtr.h"
- #include "TowerDefensePlayerStats.h"
-
namespace orxonox
{
class _TowerDefenseExport TowerDefense : public Deathmatch
@@ -50,11 +51,25 @@
TowerDefense(Context* context);
virtual ~TowerDefense();
+ std::vector<orxonox::WeakPtr<TowerDefenseEnemy> > TowerDefenseEnemyvector;
+ bool towermatrix[16][16];
+ void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr);
virtual void start(); //<! The function is called when the gametype starts
virtual void end();
virtual void tick(float dt);
//virtual void playerEntered(PlayerInfo* player);
//virtual bool playerLeft(PlayerInfo* player);
+ //Player Stats (set,get, reduce)
+ int getCredit(){ return this->credit_; }
+ int getLifes(){ return this->lifes_; }
+ int getWaveNumber(){ return this->waves_; }
+ void setCredit(int credit){ credit_ = credit; }
+ void setLifes(int lifes){ lifes_ = lifes; }
+ void setWaveNumber(int wavenumber){waves_=wavenumber; }
+ void buyTower(int cost){ credit_ -= cost;}
+ void addCredit(int credit) { credit_+=credit; }
+ void nextwave(){ waves_++;}
+ int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; }
//virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
//virtual void playerScored(PlayerInfo* player, int score);
@@ -68,8 +83,10 @@
/* Adds a tower at x, y in the playfield */
void addTower(int x, int y);
+ void upgradeTower(int x, int y);
/* Part of a temporary hack to allow the player to add towers */
ConsoleCommand* dedicatedAddTower_;
+ ConsoleCommand* dedicatedUpgradeTower_;
//TODO: void spawnNewWave()
//TODO: create a timer which regularly calls the spawnNewWave function (time driven)
@@ -78,20 +95,19 @@
private:
TowerDefenseCenterpoint *center_;
+ float time;
+ float time2;
+ int credit_;
+ int waves_;
+ int lifes_;
/* handles stats */
- TowerDefensePlayerStats *stats_;
- bool hasEnoughCreditForTower(TowerCost towerCost);
+ bool hasEnoughCreditForTower(int towerCost);
+ bool hasEnoughCreditForUpgrade();
- bool towerExists(int x, int y);
- typedef struct {
- int x;
- int y;
- } Coordinate;
- std::vector<Coordinate> addedTowersCoordinates_;
- std::vector<Tower*> towers_;
+ std::vector<TowerTurret*> towers_;
};
}
Modified: code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseController.cc
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseController.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseController.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -32,6 +32,7 @@
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "worldentities/pawns/Pawn.h"
+#include "controllers/WaypointController.h"
namespace orxonox
{
@@ -53,6 +54,7 @@
XMLPortParam(TowerDefenseController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f);
}
+
void TowerDefenseController::tick(float dt)
{
if (!this->isActive())
Copied: code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseEnemy.cc (from rev 10180, code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc)
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseEnemy.cc (rev 0)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseEnemy.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,91 @@
+//
+// TowerDefenseEnemy.cc
+// Orxonox
+//
+// Created by Jonas Erb on 22.10.14.
+
+/**
+ at brief
+See TowerDefenseReadme.txt for Information.
+
+ at ingroup TowerDefense
+*/
+#include "TowerDefenseEnemy.h"
+#include "core/CoreIncludes.h"
+//#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(TowerDefenseEnemy);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ TowerDefenseEnemy::TowerDefenseEnemy(Context* context) : SpaceShip(context)
+ {
+ RegisterObject(TowerDefenseEnemy);
+
+ this->setCollisionType(WorldEntity::Dynamic);
+ //needed to keep track of the PlayerStats coded in TowerDefense.h
+ this->td = orxonox_cast<TowerDefense*>(this->getGametype().get());
+ once_=false;
+
+ }
+ //add credit if enemy is destroyed
+ TowerDefenseEnemy::~TowerDefenseEnemy(){
+ //this->td->addCredit(1);
+ }
+
+ void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord)
+ {
+ this->Waypointsvector_.push_back(coord);
+ }
+
+
+ void TowerDefenseEnemy::tick(float dt)
+ {
+ SUPER(TowerDefenseEnemy, tick, dt);
+ }
+
+ WeakPtr<TowerDefense> TowerDefenseEnemy::getGame()
+ {
+ if (game == NULL)
+ {
+ for (ObjectList<TowerDefense>::iterator it = ObjectList<TowerDefense>::begin(); it != ObjectList<TowerDefense>::end(); ++it)
+ game = *it;
+ }
+ return game;
+ }
+
+ void TowerDefenseEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ {
+ Pawn::damage(damage, healthdamage, shielddamage, originator);
+ if (getGame() && once_ == false && getHealth() <= 0)
+ {
+ getGame()->addCredit(1);
+ once_ = true;
+ }
+ }
+/*
+ void TowerDefenseEnemy::popWaypoint()
+ {
+ if(Waypointsvector_.size()>0)
+ Waypointsvector_.pop_back();
+ }
+
+ TDCoordinate TowerDefenseEnemy::peekWaypoint()
+ {
+ if(Waypointsvector_.size()<=0){
+ TDCoordinate* coord = TDCoordinate(-1,-1);
+ return coord;
+ }else{
+ return Waypointsvector_.at(Waypointsvector_.size()-1);
+
+ }
+
+
+ }
+*/
+
+}
Copied: code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseEnemy.h (from rev 10180, code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.h)
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseEnemy.h (rev 0)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseEnemy.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,62 @@
+//
+// TowerDefenseEnemy.h
+// Orxonox
+//
+// Created by Jonas Erb on 22.10.14.
+
+/**
+ at brief
+See TowerDefenseReadme.txt for Information.
+
+ at ingroup TowerDefense
+*/
+
+
+
+#ifndef Orxonox_Tower_h
+#define Orxonox_Tower_h
+
+#include "TDCoordinate.h"
+#include "gametypes/Deathmatch.h"
+#include "towerdefense/TowerDefensePrereqs.h"
+#include "worldentities/pawns/SpaceShip.h"
+#include "util/Output.h"
+#include "controllers/ArtificialController.h"
+#include "TowerDefense.h"
+
+namespace orxonox
+{
+/* Class to give the TowerDefenseEnemy spaceships waypoints and
+ *
+ */
+ class _TowerDefenseExport TowerDefenseEnemy : public SpaceShip
+ {
+ public:
+ TowerDefenseEnemy(Context* context);
+ virtual ~TowerDefenseEnemy();
+
+ //health gibt es unter: health_
+
+ virtual void tick(float dt);
+ void addWaypoint(TDCoordinate* coord);
+ void popWaypoint();
+ TDCoordinate peekWaypoint();
+
+ virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator);
+
+
+ protected:
+
+ WeakPtr<TowerDefense> getGame();
+ WeakPtr<TowerDefense> game;
+ TowerDefense* td;
+ bool once_;
+ std::vector<TDCoordinate*> Waypointsvector_;
+
+ };
+
+
+
+}
+
+#endif /* _TowerDefense_H__ */
Modified: code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.cc
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -31,7 +31,6 @@
#include "core/XMLPort.h"
#include "util/Convert.h"
-
namespace orxonox
{
RegisterClass(TowerDefenseHUDController);
@@ -39,6 +38,7 @@
TowerDefenseHUDController::TowerDefenseHUDController(Context* context) : OverlayText(context)
{
RegisterObject(TowerDefenseHUDController);
+ this->td = 0;
}
TowerDefenseHUDController::~TowerDefenseHUDController()
@@ -49,22 +49,42 @@
void TowerDefenseHUDController::tick(float dt)
{
SUPER(TowerDefenseHUDController, tick, dt);
+ const std::string& lifes = multi_cast<std::string>(this->td->getLifes());
+ const std::string& credits = multi_cast<std::string>(this->td->getCredit());
+ const std::string& wave = multi_cast<std::string>(this->td->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 TowerDefenseHUDController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(TowerDefenseHUDController, XMLPort, xmlelement, mode);
+
+ XMLPortParam(TowerDefenseHUDController, "showlives", setShowlives, getShowlives, xmlelement, mode);
+ XMLPortParam(TowerDefenseHUDController, "showcredits", setShowcredits, getShowcredits, xmlelement, mode);
+ XMLPortParam(TowerDefenseHUDController, "showwaves", setShowwaves, getShowwaves, xmlelement, mode);
+
}
void TowerDefenseHUDController::changedOwner()
- {
- SUPER(TowerDefenseHUDController, changedOwner);
- /*
- if (this->getOwner() != NULL && this->getOwner()->getGametype())
- this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype().get());
- else
- this->owner_ = 0;
- */
- }
+ {
+ SUPER(TowerDefenseHUDController, changedOwner);
-}
+ if (this->getOwner() && this->getOwner()->getGametype())
+ {
+ this->td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get());
+ }
+ else
+ {
+ this->td = 0;
+ }
+ }
+ }
+
Modified: code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.h
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.h 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -38,11 +38,11 @@
#define _TowerDefenseHUDController_H__
#include "towerdefense/TowerDefensePrereqs.h"
-
+#include "TowerDefensePlayerStats.h"
#include "tools/interfaces/Tickable.h"
#include "overlays/OverlayText.h"
+#include "TowerDefense.h"
-
namespace orxonox
{
class _TowerDefenseExport TowerDefenseHUDController : public OverlayText, public Tickable
@@ -51,9 +51,30 @@
TowerDefenseHUDController(Context* context);
virtual ~TowerDefenseHUDController();
+
virtual void tick(float dt);
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void changedOwner();
+ 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:
+ TowerDefense* td;
+ bool showcredits;
+ bool showlives;
+ bool showwaves;
};
}
Modified: code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePlayerStats.cc
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePlayerStats.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePlayerStats.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -24,21 +24,23 @@
* Co-authors:
* ...
*/
-
+/*
#include "TowerDefensePlayerStats.h"
namespace orxonox
{
const int kDefaultCredit = 200;
-
+ const int kDefaultLifes=20;
TowerDefensePlayerStats::TowerDefensePlayerStats()
{
this->credit_ = kDefaultCredit;
this->waveNumber_ = 0;
+ this->lifes_=kDefaultLifes;
}
- /*
+
TowerDefensePlayerStats::~TowerDefensePlayerStats()
{
}
- */
+
}
+*/
Modified: code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePlayerStats.h
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePlayerStats.h 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePlayerStats.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -26,14 +26,14 @@
*
*/
- /**
+ /*
@brief
This manages the stats of the player. It is used by 'TowerDefense', the gametype
@ingroup TowerDefense
- */
+
#ifndef _TowerDefensePlayerStats_H__
#define _TowerDefensePlayerStats_H__
@@ -43,7 +43,8 @@
{
typedef enum _TowerCosts {
// Set to 0 for debug...
- TDDefaultTowerCost = 0
+ TDDefaultTowerCost = 20 ,
+ TDDefaultUpgradeCost = 15
} TowerCost;
class _TowerDefenseExport TowerDefensePlayerStats
@@ -66,11 +67,24 @@
inline void didLoadNextWave()
{ waveNumber_++; }
+ inline int getLifes()
+ {return lifes_; }
+
+ inline void reduceLifes(int NumberofLifes)
+ {lifes_-=NumberofLifes; }
+
+ inline void upgradeTower(int upgradecost)
+ { credit_ -= upgradecost;}
+
+
+
private:
int credit_;
int waveNumber_;
+ int upgradecost;
+ int lifes_;
//int baseHealth_;
};
}
-#endif /* _TowerDefensePlayerStats_H__ */
+#endif _TowerDefensePlayerStats_H__ */
Modified: code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePrereqs.h
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePrereqs.h 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefensePrereqs.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -65,10 +65,16 @@
namespace orxonox
{
class TowerDefense;
- class Tower;
+
+ class TowerDefenseTower;
+
class TowerDefenseCenterpoint;
class TowerDefenseHUDController;
class TowerDefensePlayerStats;
+ class TowerDefenseEnemy;
+ class TDCoordinate;
+ class TowerTurret;
+ class TowerDefenseTower;
}
#endif /* _TowerDefensePrereqs_H__ */
Copied: code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseTower.cc (from rev 10180, code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.cc)
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseTower.cc (rev 0)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseTower.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,137 @@
+//
+// TowerDefenseTower.cc
+// Orxonox
+//
+// Created by Fabian Mentzer on 29.04.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+/* Not implemented fully */
+
+#include "TowerDefenseTower.h"
+
+#include "core/CoreIncludes.h"
+//#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(TowerDefenseTower);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ TowerDefenseTower::TowerDefenseTower(Context* context) : Pawn(context)
+ {
+ RegisterObject(TowerDefenseTower);
+
+ this->setCollisionType(WorldEntity::Dynamic);
+ upgrade = 0;
+
+ //this->removeAllEngines();
+
+ /*
+ this->size_ = 10.0f;
+ this->delay_ = false;
+ this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
+ */
+ }
+
+ void TowerDefenseTower::setOrientation(const Quaternion& orientation)
+ {
+ static int ori;
+ //orxout() << "orientation " << ++ori << endl;
+ }
+
+ void TowerDefenseTower::rotateYaw(const Vector2& value)
+ {
+ static int yaw;
+ //orxout() << "rotateYaw " << ++yaw << endl;
+ }
+
+ void TowerDefenseTower::rotatePitch(const Vector2& value)
+ {
+ static int pitch;
+ //orxout() << "rotatePitch " << ++pitch << endl;
+ }
+
+ void TowerDefenseTower::rotateRoll(const Vector2& value)
+ {
+ static int roll;
+ //orxout() << "rotateRoll" << ++roll << endl;
+ }
+
+ bool TowerDefenseTower::upgradeTower()
+ {
+ if(upgrade < 3)
+ {
+ upgrade++;
+ float reloadrate = getReloadRate();
+ float reloadwaittime = getReloadWaitTime();
+ this->setDamageMultiplier(5000);
+
+ reloadrate = 0.5*reloadrate;
+ reloadwaittime = 0.5*reloadwaittime;
+ setReloadRate(reloadrate);
+ setReloadWaitTime(reloadwaittime);
+ 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 "TowerDefenseTowerMover". This is the controllable entity that the
+ // player controls in order to move the TowerDefenseTower along the centerpoint and in order to place the TowerDefenseTower at the appropriate position.
+ //
+
+ // The TowerDefenseTower 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 TowerDefenseTower are in the same team)
+
+ //How to move a TowerDefenseTower: simply attach the TowerDefenseTower to the TowerDefenseTowerMover
+ //How to place a TowerDefenseTower: detach the TowerDefenseTower from the TowerDefenseTowerMover
+
+ /**
+ @brief
+ Overloaded the function to rotate the stone.
+ @param value
+ A vector whose first component is the angle by which to rotate.
+ */
+ /*
+ void TowerDefenseTower::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 TowerDefenseTower::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();
+ }
+ }
+ */
+}
Copied: code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseTower.h (from rev 10180, code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.h)
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseTower.h (rev 0)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseTower.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,55 @@
+//
+// TowerDefenseTower.h
+// Orxonox
+//
+// Created by Fabian Mentzer on 29.04.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+/**
+ at brief
+See TowerDefenseTowerDefenseReadme.txt for Information.
+
+ at ingroup TowerDefenseTowerDefense
+*/
+
+
+#ifndef Orxonox_TowerDefenseTower_h
+#define Orxonox_TowerDefenseTower_h
+
+#include "towerdefense/TowerDefensePrereqs.h"
+#include "worldentities/pawns/SpaceShip.h"
+
+
+namespace orxonox
+{
+ class _TowerDefenseExport TowerDefenseTower : public Pawn
+ {
+ public:
+ TowerDefenseTower(Context* context);
+ virtual ~TowerDefenseTower() {};
+
+ // Maybe later override these to move TowerDefenseTowers with cursor keys
+ /*
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+ */
+
+ // Overriding these to stop TowerDefenseTowers 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(TowerDefense* Towerdefense)
+ { assert(Towerdefense); game_ = Towerdefense; }
+ private:
+ TowerDefense* game_;
+ int upgrade;
+ };
+}
+
+
+#endif
Copied: code/branches/presentationHS14/src/modules/towerdefense/TowerTurret.cc (from rev 10180, code/branches/towerdefenseHS14/src/modules/towerdefense/TowerTurret.cc)
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerTurret.cc (rev 0)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerTurret.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,41 @@
+//
+// Tower.cc
+// Orxonox
+//
+// Created by Fabian Mentzer on 29.04.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+/* Not implemented fully */
+
+//#include "Tower.h"
+#include "TowerTurret.h"
+
+#include "core/CoreIncludes.h"
+//#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(TowerTurret);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ TowerTurret::TowerTurret(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(TowerTurret);
+
+ this->setCollisionType(WorldEntity::Static);
+
+
+ }
+
+ void TowerTurret::setOrientation(const Quaternion& orientation)
+ {
+ static int ori;
+ orxout() << "orientation " << ++ori << endl;
+ }
+
+
+}
Copied: code/branches/presentationHS14/src/modules/towerdefense/TowerTurret.h (from rev 10180, code/branches/towerdefenseHS14/src/modules/towerdefense/TowerTurret.h)
===================================================================
--- code/branches/presentationHS14/src/modules/towerdefense/TowerTurret.h (rev 0)
+++ code/branches/presentationHS14/src/modules/towerdefense/TowerTurret.h 2014-12-15 14:58:14 UTC (rev 10181)
@@ -0,0 +1,53 @@
+//
+// Tower.h
+// Orxonox
+//
+// Created by Fabian Mentzer on 29.04.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+/**
+ at brief
+See TowerDefenseReadme.txt for Information.
+
+ at ingroup TowerDefense
+*/
+
+
+#ifndef Orxonox_Tower_h
+#define Orxonox_Tower_h
+
+#include "towerdefense/TowerDefensePrereqs.h"
+#include "worldentities/pawns/SpaceShip.h"
+#include "worldentities/StaticEntity.h"
+
+
+namespace orxonox
+{
+ class _TowerDefenseExport TowerTurret : public StaticEntity
+ {
+ public:
+ TowerTurret(Context* context);
+ virtual ~TowerTurret() {};
+
+ // Maybe later override these to move towers with cursor keys
+ /*
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+ */
+
+ // Overriding these to stop towers 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);
+
+ void setGame(TowerDefense* towerdefense)
+ { assert(towerdefense); game_ = towerdefense; }
+ private:
+ TowerDefense* game_;
+ };
+}
+
+
+#endif
Modified: code/branches/presentationHS14/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/presentationHS14/src/orxonox/controllers/ArtificialController.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/orxonox/controllers/ArtificialController.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -93,7 +93,7 @@
static const float hardcoded_projectile_speed = 1250;
- this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getVelocity());
+ this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(), hardcoded_projectile_speed, this->target_->getWorldPosition(), this->target_->getVelocity());
this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
Modified: code/branches/presentationHS14/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/presentationHS14/src/orxonox/worldentities/WorldEntity.cc 2014-12-15 14:07:39 UTC (rev 10180)
+++ code/branches/presentationHS14/src/orxonox/worldentities/WorldEntity.cc 2014-12-15 14:58:14 UTC (rev 10181)
@@ -413,8 +413,9 @@
}
else if (this->isDynamic())
{
- orxout(internal_warning) << "Cannot attach a dynamic object to a WorldEntity." << endl;
- return false;
+ //***HACKY HACK (to allow turrets to be attached)***
+ //orxout(internal_warning) << "Cannot attach a dynamic object to a WorldEntity." << endl;
+ //return false;
}
else if (this->isKinematic() && newParent->isDynamic())
{
More information about the Orxonox-commit
mailing list