Organised and added fan art
This commit is contained in:
47
Assets/Scripts/Global/GameStateController.cs
Normal file
47
Assets/Scripts/Global/GameStateController.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using PashaBibko.Pacore.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation.Global
|
||||
{
|
||||
public enum GameState
|
||||
{
|
||||
Simulation,
|
||||
Building,
|
||||
UpgradeMenu,
|
||||
Paused,
|
||||
Default
|
||||
}
|
||||
|
||||
[CreateInstanceOnStart] public class GameStateController : MonoBehaviour
|
||||
{
|
||||
private static GameStateController Instance;
|
||||
|
||||
[SerializeField, InspectorReadOnly("Game State")] private GameState InternalState;
|
||||
public static GameState State
|
||||
{
|
||||
get => Instance.InternalState;
|
||||
set
|
||||
{
|
||||
if (Instance.InternalState != value)
|
||||
{
|
||||
Debug.Log($"Changing state from [{Instance.InternalState}] to [{value}]");
|
||||
Instance.InternalState = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Is(GameState state) => State == state;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance is not null)
|
||||
{
|
||||
Debug.LogError("Cannot have multiple instances of [GameStateController]");
|
||||
return;
|
||||
}
|
||||
|
||||
InternalState = GameState.Default;
|
||||
Instance = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Global/GameStateController.cs.meta
Normal file
11
Assets/Scripts/Global/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:
|
||||
31
Assets/Scripts/Global/MoneyController.cs
Normal file
31
Assets/Scripts/Global/MoneyController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using PashaBibko.Pacore.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation.Global
|
||||
{
|
||||
[CreateInstanceOnStart] public class MoneyController : MonoBehaviour
|
||||
{
|
||||
private static MoneyController Instance;
|
||||
|
||||
[SerializeField, InspectorReadOnly("Game State")] private ulong InternalCurrentMoney;
|
||||
|
||||
public static ulong Current
|
||||
{
|
||||
get => Instance.InternalCurrentMoney;
|
||||
set => Instance.InternalCurrentMoney = value;
|
||||
}
|
||||
|
||||
public static void Add(ulong amount) => Instance.InternalCurrentMoney += amount;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance is not null)
|
||||
{
|
||||
Debug.LogError("Cannot have multiple instances of [MoneyController]");
|
||||
return;
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Global/MoneyController.cs.meta
Normal file
3
Assets/Scripts/Global/MoneyController.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6958b34c3d774828a5b36ad962b9fa09
|
||||
timeCreated: 1774874038
|
||||
Reference in New Issue
Block a user