Make Gamemanager
This commit is contained in:
13
Assets/GameManager.cs
Normal file
13
Assets/GameManager.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class GameManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public enum GameMode
|
||||||
|
{
|
||||||
|
freeForAll,
|
||||||
|
teamDeathmatch,
|
||||||
|
captureTheFlag
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameMode gameMode = GameMode.freeForAll;
|
||||||
|
}
|
||||||
2
Assets/GameManager.cs.meta
Normal file
2
Assets/GameManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d6e4006937b044c9ab3de25a7ab68162
|
||||||
@@ -165,6 +165,50 @@ Transform:
|
|||||||
- {fileID: 1162228707}
|
- {fileID: 1162228707}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &49968921
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 49968922}
|
||||||
|
- component: {fileID: 49968923}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: GameManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &49968922
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 49968921}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 1000.2525, y: 999.4244, z: 1.2390065}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &49968923
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 49968921}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d6e4006937b044c9ab3de25a7ab68162, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!224 &139217491 stripped
|
--- !u!224 &139217491 stripped
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_CorrespondingSourceObject: {fileID: 6892066976245176997, guid: e98314581589e49cf928afa2ae1398f2, type: 3}
|
m_CorrespondingSourceObject: {fileID: 6892066976245176997, guid: e98314581589e49cf928afa2ae1398f2, type: 3}
|
||||||
@@ -5012,3 +5056,4 @@ SceneRoots:
|
|||||||
- {fileID: 1335742587}
|
- {fileID: 1335742587}
|
||||||
- {fileID: 804358387}
|
- {fileID: 804358387}
|
||||||
- {fileID: 1633531801}
|
- {fileID: 1633531801}
|
||||||
|
- {fileID: 49968922}
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ public class PlayerLives : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public int maxLives = 3;
|
public int maxLives = 3;
|
||||||
public int currentLives;
|
public int currentLives;
|
||||||
public string gameMode = "free-for-all";
|
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
if (gameMode == "free-for-all")
|
if (GameManager.gameMode == GameManager.GameMode.freeForAll)
|
||||||
{
|
{
|
||||||
currentLives = maxLives;
|
currentLives = maxLives;
|
||||||
}
|
}
|
||||||
@@ -19,7 +18,7 @@ public class PlayerLives : MonoBehaviour
|
|||||||
}
|
}
|
||||||
public void PlayerDied()
|
public void PlayerDied()
|
||||||
{
|
{
|
||||||
if (gameMode == "free-for-all")
|
if (GameManager.gameMode == GameManager.GameMode.freeForAll)
|
||||||
{
|
{
|
||||||
currentLives--;
|
currentLives--;
|
||||||
if (currentLives <= 0)
|
if (currentLives <= 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user