Example #1
0
        /// <summary>
        /// Update by Unity
        /// </summary>
        void Update()
        {
            IPlayerState nextState = m_currentState.GetNextState();

            if (nextState != null)
            {
                StateTransition(nextState);
            }
            m_currentState.OnUpdate();

            //向きをスプライトに反映
            m_spriteRenderer.flipX = m_currentDirection == Direction.RIGHT;
        }
Example #2
0
        // Update is called once per frame
        void Update()
        {
            #region FSMによる実装
            IPlayerState nextState = m_currentState.GetNextState();

            if (nextState != null)
            {
                StateTransition(nextState);
            }

            m_currentState.OnUpdate();
            #endregion

            transform.localScale = new Vector3(
                (int)m_currentDirection,
                transform.localScale.y,
                transform.localScale.z);
        }