You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
762 B
C#
34 lines
762 B
C#
using UnityEngine;
|
|
using D2D.Core;
|
|
using D2D.Utilities;
|
|
|
|
|
|
namespace D2D
|
|
{
|
|
public class SwitchOff : GameStateMachineUser
|
|
{
|
|
private enum GameState
|
|
{
|
|
Running,
|
|
Win,
|
|
Lose,
|
|
GameFinish,
|
|
}
|
|
|
|
[SerializeField] private GameState _on;
|
|
|
|
protected override void OnGameRun() => DisableIf(GameState.Running);
|
|
|
|
protected override void OnGameFinish() => DisableIf(GameState.GameFinish);
|
|
|
|
protected override void OnGameLose() => DisableIf(GameState.Lose);
|
|
|
|
protected override void OnGameWin() => DisableIf(GameState.Win);
|
|
|
|
private void DisableIf(GameState s)
|
|
{
|
|
if (_on == s)
|
|
gameObject.Off();
|
|
}
|
|
}
|
|
} |