AC Game State Checker

mail@pastecode.io avatar
unknown
csharp
10 months ago
2.0 kB
7
No Index
Never
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace AC
{
    [System.Serializable]
    public class ActionCheckGameState : ActionCheck
    {

        public int constantID = 0;

        public enum Mode { Normal, Cutscene, Paused, DialogOptions }
        public Mode mode = Mode.Normal;

        public bool entryBool = false;


        public override ActionCategory Category { get { return ActionCategory.Custom; } }
        public override string Title { get { return "Game State Checker"; } }
        public override string Description { get { return "Check the Game State."; } }

        public ActionCheckGameState()
        {
            this.isDisplayed = true;
            category = ActionCategory.ThirdParty;
            title = "Check the Game State";
            description = "Checks the Game State and return true or false";
        }

        public override int GetNextOutputIndex()
        {
            if (mode == Mode.Normal)
            {
                entryBool = KickStarter.stateHandler.gameState == GameState.Normal;
                return entryBool ? 0 : 1;
            }
            else if (mode == Mode.Cutscene)
            {
                entryBool = KickStarter.stateHandler.gameState == GameState.Cutscene;
                return entryBool ? 0 : 1;
            }
            else if (mode == Mode.Paused)
            {
                entryBool = KickStarter.stateHandler.gameState == GameState.Paused;
                return entryBool ? 0 : 1;
            }
            else
            {
                entryBool = KickStarter.stateHandler.gameState == GameState.DialogOptions;
                return entryBool ? 0 : 1;
            }

        }


#if UNITY_EDITOR
        override public void ShowGUI()
        {
            mode = (Mode)EditorGUILayout.EnumPopup(new GUIContent("Game State to check:", "Set which GameState should be checked"), mode);
            AfterRunningOption();
        }
#endif
    }

}