Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dyingIsMainstream
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gamejam-gpn15
dyingIsMainstream
Commits
c77f78df
Commit
c77f78df
authored
Jun 06, 2015
by
Tim Reiter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented back to menu from game over panel.
parent
3df54979
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
10 deletions
+57
-10
Turret.prefab
Assets/Resources/Prefabs/Turret.prefab
+0
-0
GameMaster.cs
Assets/Scripts/GameMaster.cs
+41
-10
Menu.cs
Assets/Scripts/Menu.cs
+16
-0
game.unity
Assets/game.unity
+0
-0
No files found.
Assets/Resources/Prefabs/Turret.prefab
View file @
c77f78df
No preview for this file type
Assets/Scripts/GameMaster.cs
View file @
c77f78df
...
...
@@ -7,7 +7,11 @@ public class GameMaster : MonoBehaviour
{
DeserializedLevelsLoader
levelLoader
;
public
PlayerControl
[]
playerPrefabs
;
public
GameObject
gameUIPanel
;
public
GameObject
gameOverPanel
;
public
GameObject
menuBloomPanel
;
public
GameObject
menuPanel
;
public
Text
rankingText
;
private
GameStateTracker
gameStateTracker
;
...
...
@@ -27,21 +31,31 @@ public class GameMaster : MonoBehaviour
level
=
Random
.
Range
(
0
,
levelLoader
.
getLevelCount
());
levelLoader
.
loadLevel
(
level
);
de
leteAllPlayer
s
();
de
stroyDynamicObject
s
();
spawnPlayers
(
numberOfPlayers
);
}
private
void
deleteAllPlayers
()
private
void
deleteAllLevelObjects
()
{
GameObject
level
=
GameObject
.
Find
(
"XmlItems"
);
Destroy
(
level
);
destroyDynamicObjects
();
}
//deletes all objects spawned during the game:
private
void
destroyDynamicObjects
()
{
foreach
(
Transform
child
in
deleteAllChildrenAtRestart
.
transform
)
{
if
(
child
!=
deleteAllChildrenAtRestart
.
gameObject
)
{
Destroy
(
child
.
gameObject
,
0f
);
Destroy
(
child
.
gameObject
,
0f
);
}
}
}
private
void
spawnPlayers
(
int
count
)
{
Debug
.
Log
(
"spawning "
+
count
+
" players"
);
...
...
@@ -103,11 +117,7 @@ public class GameMaster : MonoBehaviour
}
void
Update
()
{
if
(
gameOverPanel
.
activeSelf
)
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
Space
))
private
void
restartGame
()
{
gameStateTracker
.
reset
();
...
...
@@ -115,9 +125,30 @@ public class GameMaster : MonoBehaviour
rankingText
.
text
=
""
;
gameOverPanel
.
SetActive
(
false
);
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Return
))
private
void
goToMenu
()
{
rankingText
.
text
=
""
;
deleteAllLevelObjects
();
menuBloomPanel
.
SetActive
(
true
);
menuPanel
.
SetActive
(
true
);
menuPanel
.
GetComponent
<
Menu
>().
reset
();
gameOverPanel
.
SetActive
(
false
);
gameUIPanel
.
SetActive
(
false
);
}
void
Update
()
{
if
(
gameOverPanel
.
activeSelf
)
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
Space
))
{
restartGame
();
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Return
))
{
goToMenu
();
}
}
}
...
...
Assets/Scripts/Menu.cs
View file @
c77f78df
...
...
@@ -17,6 +17,22 @@ public class Menu : MonoBehaviour
private
bool
WASDAdded
,
ArrowAdded
,
GP1Added
,
GP2Added
,
GP3Added
,
GP4Added
;
public
void
reset
()
{
//resets the number of players:
numberOfRegisteredPlayers
=
0
;
p1Image
.
SetActive
(
false
);
p2Image
.
SetActive
(
false
);
p3Image
.
SetActive
(
false
);
p4Image
.
SetActive
(
false
);
WASDAdded
=
false
;
ArrowAdded
=
false
;
GP1Added
=
false
;
GP2Added
=
false
;
GP3Added
=
false
;
GP4Added
=
false
;
}
void
Start
()
{
#
region
init
bools
...
...
Assets/game.unity
View file @
c77f78df
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment