Exemplo n.º 1
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Initialization

        // Constriuctor that calls Base
        public Player() : base(100)
        {
            #region State Machine Init

            // Init state machine
            statemachine = new StateMachine <PlayerState>();
            statemachine.SetState(PlayerState.Normal);

            /// Add Normal state
            statemachine.AddEntry(PlayerState.Normal, NormalEnter);
            statemachine.AddUpdate(PlayerState.Normal, NormalUpdate);
            statemachine.AddExit(PlayerState.Normal, NormalExit);

            /// Add MoveToCenter state
            statemachine.AddEntry(PlayerState.MoveToCenter, CenterEnter);
            statemachine.AddUpdate(PlayerState.MoveToCenter, CenterUpdate);
            statemachine.AddExit(PlayerState.MoveToCenter, CenterExit);

            #endregion

            // Init sprite|s
            playersprite = new Sprite(transform);
        }