Ejemplo n.º 1
0
    void Start()
    {
        customFSMManager = gameObject.AddComponent <CustomFSMManager>();
        customFSMManager.Initialize(typeof(MyState), this.GetType());

        customFSMManager.StateMachineChange(MyState.Loop);
        // Should print
        // Exit Start to Loop
        // Enter Loop from Start
        // Exit Loop to End
        // Enter End from Loop
    }
 // Use this for initialization
 public virtual void Initialize(GeneralOptions options, GameScene gameScene)
 {
     this.gameScene = gameScene;
     difficultLevel = (DifficultLevel)options["difficultLevel"];
     gameMode       = (GameMode)options["gameMode"];
     isSavedGame    = (bool)options ["isSavedGame"];
     SetupRowColOfBoard(difficultLevel);
     // setup custom fsm
     fsm = gameObject.AddComponent <CustomFSMManager> ();
     fsm.Initialize(typeof(GameState), this, false);
     StateMachineChange = new StateMachineChangeDelegate(fsm.StateMachineChange);
     if (isSavedGame)
     {
         StateMachineChange(GameState.LoadSavedGame);
     }
     else
     {
         StateMachineChange(GameState.StartGame);
     }
 }