public void Initialize(FSMSystem fsmSystem)
    {
        this.FsmSystem = fsmSystem;
        bool letControllerControlGui = (MultiPanelDeclarations.Count == 0); //Only when there are no panel declaration scripts, should the controller be in control of the GUI enabling/disabling.

        if (StateController != null)
        {
            AbstractPanelDeclarations primaryPanelDeclaration = null;
            if (MultiPanelDeclarations.Count > 0)
            {
                primaryPanelDeclaration = MultiPanelDeclarations[0];
            }
            StateController.ControllerInitialize(fsmSystem, this, primaryPanelDeclaration, letControllerControlGui);
        }
        if (MultiPanelDeclarations.Count > 0)
        {
            foreach (AbstractPanelDeclarations panelDeclarations in MultiPanelDeclarations)
            {
                panelDeclarations.OnButtonClicked += this.GUIButtonEventHandler;
                panelDeclarations.PanelInitialize(fsmSystem, !letControllerControlGui, this);
            }
        }
        NeedsGUILayout = true;
        TimeInState    = 0;
        OnInitialize();
    }
 public AbstractFSMState(string stateName, AbstractPanelDeclarations panelDeclarations)
 {
     StateName              = stateName;
     StateController        = null;
     MultiPanelDeclarations = new List <AbstractPanelDeclarations>();
     if (panelDeclarations != null)
     {
         MultiPanelDeclarations.Add(panelDeclarations);
     }
 }
 public void ControllerInitialize(FSMSystem fsmSystem, AbstractFSMState state, AbstractPanelDeclarations primaryPanelDeclarations, bool autoGUISetActive)
 {
     AutoGUISetActive         = autoGUISetActive;
     FsmSystem                = fsmSystem;
     State                    = state;
     PrimaryPanelDeclarations = primaryPanelDeclarations;
     if (GUIPanel != null && AutoGUISetActive == true)
     {
         SetPanelActive(false);
     }
     if (PrimaryPanelDeclarations != null)
     {
         PrimaryPanelDeclarations.OnButtonClicked += this.GUIButtonEventHandler;
     }
     OnInitialize();
 }
 public GameStateStartupGame(string stateName, AbstractFSMStateController stateController, AbstractPanelDeclarations panelDeclarations)
     : base(stateName, stateController, panelDeclarations)
 {
 }
 public GameStateStartupGame(string stateName, AbstractPanelDeclarations panelIntro)
     : base(stateName, panelIntro)
 {
     IsGameDataLoaded = false;
     HasIntroFinished = true; //TODO: just until intro is implemented, then set correctly
 }