From 59b64a680fdc91216f2fb353ee4fe1adea0c676f Mon Sep 17 00:00:00 2001 From: Pasha Date: Mon, 30 Mar 2026 13:13:14 +0100 Subject: [PATCH] Added GameState controller --- Assets/Scenes/SampleScene.unity | 10 +++--- Assets/Scripts/GameStateController.cs | 41 ++++++++++++++++++++++ Assets/Scripts/GameStateController.cs.meta | 11 ++++++ 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 Assets/Scripts/GameStateController.cs create mode 100644 Assets/Scripts/GameStateController.cs.meta diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 1c64d3d..a6fe33f 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -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 diff --git a/Assets/Scripts/GameStateController.cs b/Assets/Scripts/GameStateController.cs new file mode 100644 index 0000000..ea4b027 --- /dev/null +++ b/Assets/Scripts/GameStateController.cs @@ -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; + } + } +} diff --git a/Assets/Scripts/GameStateController.cs.meta b/Assets/Scripts/GameStateController.cs.meta new file mode 100644 index 0000000..e4dc89c --- /dev/null +++ b/Assets/Scripts/GameStateController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e7e7ce52c18c2de49bf808434eae1de7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: