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
28ad94b1
Commit
28ad94b1
authored
Jun 05, 2015
by
Tim Reiter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added option to fast load levels with key 0 to 9.
parent
dfb43f00
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
4 deletions
+16
-4
GameMaster.prefab
Assets/Resources/Prefabs/GameMaster.prefab
+0
-0
GameMaster.cs
Assets/Scripts/GameMaster.cs
+3
-2
Menu.cs
Assets/Scripts/Menu.cs
+13
-2
game.unity
Assets/game.unity
+0
-0
No files found.
Assets/Resources/Prefabs/GameMaster.prefab
View file @
28ad94b1
No preview for this file type
Assets/Scripts/GameMaster.cs
View file @
28ad94b1
...
@@ -15,14 +15,15 @@ public class GameMaster : MonoBehaviour {
...
@@ -15,14 +15,15 @@ public class GameMaster : MonoBehaviour {
levelLoader
=
new
DeserializedLevelsLoader
();
levelLoader
=
new
DeserializedLevelsLoader
();
}
}
public
void
loadLevel
(
int
numberOfPlayers
)
public
void
loadLevel
(
int
numberOfPlayers
,
int
level
=
-
1
)
{
{
levelLoader
.
loadLevel
();
levelLoader
.
loadLevel
(
level
);
deleteAllPlayers
();
deleteAllPlayers
();
spawnPlayers
(
numberOfPlayers
);
spawnPlayers
(
numberOfPlayers
);
}
}
private
void
deleteAllPlayers
()
private
void
deleteAllPlayers
()
{
{
foreach
(
GameObject
player
in
GameObject
.
FindGameObjectsWithTag
(
"Player"
))
foreach
(
GameObject
player
in
GameObject
.
FindGameObjectsWithTag
(
"Player"
))
...
...
Assets/Scripts/Menu.cs
View file @
28ad94b1
...
@@ -35,14 +35,14 @@ public class Menu : MonoBehaviour
...
@@ -35,14 +35,14 @@ public class Menu : MonoBehaviour
}
}
//returns true if game was started;
//returns true if game was started;
private
bool
startGameIfPossible
()
private
bool
startGameIfPossible
(
int
levelNumber
=
-
1
)
{
{
if
(
numberOfRegisteredPlayers
>
1
||
(
numberOfRegisteredPlayers
>
0
&&
Debug
.
isDebugBuild
))
if
(
numberOfRegisteredPlayers
>
1
||
(
numberOfRegisteredPlayers
>
0
&&
Debug
.
isDebugBuild
))
{
{
gameUI
.
SetActive
(
true
);
gameUI
.
SetActive
(
true
);
gameStateTracker
.
setNumberOfPlayers
(
numberOfRegisteredPlayers
);
gameStateTracker
.
setNumberOfPlayers
(
numberOfRegisteredPlayers
);
gameStateTracker
.
reset
();
gameStateTracker
.
reset
();
gameMaster
.
loadLevel
(
numberOfRegisteredPlayers
);
gameMaster
.
loadLevel
(
numberOfRegisteredPlayers
,
levelNumber
);
gameObject
.
SetActive
(
false
);
gameObject
.
SetActive
(
false
);
return
true
;
return
true
;
}
}
...
@@ -51,6 +51,17 @@ public class Menu : MonoBehaviour
...
@@ -51,6 +51,17 @@ public class Menu : MonoBehaviour
void
Update
()
void
Update
()
{
{
if
(
Debug
.
isDebugBuild
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
if
(
Input
.
GetKeyDown
(
i
.
ToString
()))
{
startGameIfPossible
(
i
);
}
}
}
if
(
Input
.
GetKeyDown
(
KeyCode
.
Space
))
if
(
Input
.
GetKeyDown
(
KeyCode
.
Space
))
{
{
if
(
WASDAdded
)
if
(
WASDAdded
)
...
...
Assets/game.unity
View file @
28ad94b1
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