Make Gamemanager

This commit is contained in:
RochesterX
2025-02-17 18:23:05 -05:00
parent fe8c8c3ef4
commit 0da9280a78
4 changed files with 62 additions and 3 deletions

13
Assets/GameManager.cs Normal file
View File

@@ -0,0 +1,13 @@
using UnityEngine;
public class GameManager : MonoBehaviour
{
public enum GameMode
{
freeForAll,
teamDeathmatch,
captureTheFlag
}
public static GameMode gameMode = GameMode.freeForAll;
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d6e4006937b044c9ab3de25a7ab68162

View File

@@ -165,6 +165,50 @@ Transform:
- {fileID: 1162228707}
m_Father: {fileID: 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
RectTransform:
m_CorrespondingSourceObject: {fileID: 6892066976245176997, guid: e98314581589e49cf928afa2ae1398f2, type: 3}
@@ -5012,3 +5056,4 @@ SceneRoots:
- {fileID: 1335742587}
- {fileID: 804358387}
- {fileID: 1633531801}
- {fileID: 49968922}

View File

@@ -4,11 +4,10 @@ public class PlayerLives : MonoBehaviour
{
public int maxLives = 3;
public int currentLives;
public string gameMode = "free-for-all";
private void Start()
{
if (gameMode == "free-for-all")
if (GameManager.gameMode == GameManager.GameMode.freeForAll)
{
currentLives = maxLives;
}
@@ -19,7 +18,7 @@ public class PlayerLives : MonoBehaviour
}
public void PlayerDied()
{
if (gameMode == "free-for-all")
if (GameManager.gameMode == GameManager.GameMode.freeForAll)
{
currentLives--;
if (currentLives <= 0)