Added GameState controller
This commit is contained in:
@@ -586,7 +586,7 @@ RectTransform:
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.005346669, y: 0.005346669, z: 0.005346669}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children:
|
||||
- {fileID: 1944344878}
|
||||
- {fileID: 2112507919}
|
||||
@@ -719,8 +719,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 1000, y: 100}
|
||||
m_AnchoredPosition: {x: 0, y: 75}
|
||||
m_SizeDelta: {x: 3840, y: 150}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!61 &2112507920
|
||||
BoxCollider2D:
|
||||
@@ -765,7 +765,7 @@ BoxCollider2D:
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1000, y: 100}
|
||||
m_Size: {x: 3840, y: 150}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &2112507921
|
||||
MonoBehaviour:
|
||||
@@ -780,7 +780,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
|
||||
41
Assets/Scripts/GameStateController.cs
Normal file
41
Assets/Scripts/GameStateController.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using PashaBibko.Pacore.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation
|
||||
{
|
||||
public enum GameState
|
||||
{
|
||||
Simulation,
|
||||
Building,
|
||||
UpgradeMenu,
|
||||
Paused,
|
||||
None
|
||||
}
|
||||
|
||||
[CreateInstanceOnStart] public class GameStateController : MonoBehaviour
|
||||
{
|
||||
private static GameStateController Instance;
|
||||
|
||||
private GameState InternalState = GameState.None;
|
||||
public static GameState State
|
||||
{
|
||||
get => Instance.InternalState;
|
||||
set
|
||||
{
|
||||
Debug.Log($"Changing state from [{Instance.InternalState}] to [{value}]");
|
||||
Instance.InternalState = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance is not null)
|
||||
{
|
||||
Debug.LogError($"Cannot have multiple instances of [GameStateController]");
|
||||
return;
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/GameStateController.cs.meta
Normal file
11
Assets/Scripts/GameStateController.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7e7ce52c18c2de49bf808434eae1de7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user