-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GameManager class allows me to move state code (death, health counter) out of player and into a more appropriate place. It also allows for future functionality, like easy fade in of the death panel.
- Loading branch information
1 parent
5a63036
commit 50d617c
Showing
5 changed files
with
211 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"files.exclude": | ||
{ | ||
"**/.DS_Store":true, | ||
"**/.git":true, | ||
"**/.gitignore":true, | ||
"**/.gitmodules":true, | ||
"**/*.booproj":true, | ||
"**/*.pidb":true, | ||
"**/*.suo":true, | ||
"**/*.user":true, | ||
"**/*.userprefs":true, | ||
"**/*.unityproj":true, | ||
"**/*.dll":true, | ||
"**/*.exe":true, | ||
"**/*.pdf":true, | ||
"**/*.mid":true, | ||
"**/*.midi":true, | ||
"**/*.wav":true, | ||
"**/*.gif":true, | ||
"**/*.ico":true, | ||
"**/*.jpg":true, | ||
"**/*.jpeg":true, | ||
"**/*.png":true, | ||
"**/*.psd":true, | ||
"**/*.tga":true, | ||
"**/*.tif":true, | ||
"**/*.tiff":true, | ||
"**/*.3ds":true, | ||
"**/*.3DS":true, | ||
"**/*.fbx":true, | ||
"**/*.FBX":true, | ||
"**/*.lxo":true, | ||
"**/*.LXO":true, | ||
"**/*.ma":true, | ||
"**/*.MA":true, | ||
"**/*.obj":true, | ||
"**/*.OBJ":true, | ||
"**/*.asset":true, | ||
"**/*.cubemap":true, | ||
"**/*.flare":true, | ||
"**/*.mat":true, | ||
"**/*.meta":true, | ||
"**/*.prefab":true, | ||
"**/*.unity":true, | ||
"build/":true, | ||
"Build/":true, | ||
"Library/":true, | ||
"library/":true, | ||
"obj/":true, | ||
"Obj/":true, | ||
"ProjectSettings/":true, | ||
"temp/":true, | ||
"Temp/":true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
//using a singleton style class (in the unity way) | ||
public class GameManager : MonoBehaviour | ||
{ | ||
static GameManager _instance=null; | ||
|
||
public Text healthText; | ||
public GameObject deathPanel; | ||
|
||
void Awake(){ | ||
if(_instance==null){ | ||
_instance=this; | ||
} | ||
} | ||
|
||
public static GameManager instance(){ | ||
return _instance; | ||
} | ||
|
||
public void updateHealthText(int health){ | ||
healthText.text="x"+health; | ||
} | ||
|
||
public void deathPanelSwich(bool state){ | ||
deathPanel.SetActive(state); | ||
} | ||
|
||
// Start is called before the first frame update | ||
void Start() | ||
{ | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters