예제 #1
0
        protected override void Update()
        {
            base.Update();
            m_State.Update(Time.deltaTime);
            switch (m_State.CurrentStateID)
            {
            case EState.IDLE:
                if (m_doLateVanish)
                {
                    m_animatorControl.EventSummon(3);
                    m_State.ChangeState(EState.VANISH);
                    m_doLateVanish = false;
                }
                break;

            case EState.VANISH:
                if (m_animator.GetCurrentAnimatorStateInfo(0).nameHash == m_vanishHash)
                {
                    if (m_animator.IsInTransition(0))
                    {
                        ((Monster)MyController).VanishAnimationDone.Trigger();
                        PlaceMonster();
                        ((Monster)MyController).AiHandler.Update();
                        m_State.ChangeState(EState.IDLE);
                    }
                }
                else if (m_State.IsStateTimeout)
                {
                    ((Monster)MyController).VanishAnimationDone.Trigger();
                    PlaceMonster();
                    ((Monster)MyController).AiHandler.Update();
                    m_State.ChangeState(EState.IDLE);
                }
                break;

            case EState.APPEAR:
                if (m_animator.GetCurrentAnimatorStateInfo(0).nameHash == m_appearHash)
                {
                    if (m_animator.IsInTransition(0))
                    {
                        ((Monster)MyController).AppearAnimationDone.Trigger();
                        ((Monster)MyController).AiHandler.Update();
                        m_State.ChangeState(EState.IDLE);
                    }
                }
                else if (m_State.IsStateTimeout)
                {
                    ((Monster)MyController).AppearAnimationDone.Trigger();
                    ((Monster)MyController).AiHandler.Update();
                    m_State.ChangeState(EState.IDLE);
                }
                break;
            }
        }
예제 #2
0
        private void Update()
        {
            Single stateOverrun = m_state.CurrentStateTime + Time.deltaTime - m_state.CurrentStateDuration;

            m_state.Update(Time.deltaTime);
            if (m_state.IsState(EState.MOVING))
            {
                Vector3 localPosition;
                Helper.Lerp(ref m_oldPosition, ref m_targetPosition, m_state.CurrentStateTimePer, out localPosition);
                transform.localPosition = localPosition;
                if (m_state.IsStateTimeout)
                {
                    m_stateOverrun = stateOverrun;
                    m_state.ChangeState(EState.IDLE);
                    FXMainCamera.Instance.StopWalkFX();
                    if (MyController != null)
                    {
                        ((MovingEntity)MyController).MovementDone.Trigger();
                    }
                }
            }
            else
            {
                m_stateOverrun = 0f;
                if (m_state.IsState(EState.ROTATING))
                {
                    transform.localRotation = Quaternion.Lerp(m_oldRotation, m_targetRotation, m_state.CurrentStateTimePer);
                    if (m_state.IsStateTimeout)
                    {
                        m_state.ChangeState(EState.IDLE);
                        FXMainCamera.Instance.StopWalkFX();
                        if (MyController != null)
                        {
                            ((MovingEntity)MyController).RotationDone.Trigger();
                        }
                    }
                }
            }
            HandleDelayedSound();
        }
예제 #3
0
        protected virtual void Update()
        {
            switch (m_State.CurrentState.Id)
            {
            case EState.IDLE:
                if (m_State.IsStateTimeout && m_CommandQueue.Count > 0)
                {
                    Action action = m_CommandQueue.Dequeue();
                    action();
                }
                goto IL_F6;

            case EState.ATTACK:
            case EState.ATTACK_RANGED:
                if (m_State.IsStateTimeout)
                {
                    Debug.LogWarning(String.Concat(new Object[]
                    {
                        "State machine of CombatViewBase (",
                        name,
                        ") has timeouted in state (",
                        m_State.CurrentState.Id,
                        ")"
                    }));
                    m_State.ChangeState(EState.IDLE);
                    ChangeStateFromAttackToIdle(null);
                }
                goto IL_F6;
            }
            if (m_State.IsStateTimeout)
            {
                m_State.ChangeState(EState.IDLE);
            }
IL_F6:
            m_State.Update(Time.deltaTime);
        }
예제 #4
0
 public virtual void UpdateTurn()
 {
     m_stateMachine.Update();
 }
예제 #5
0
 private void Update()
 {
     m_state.Update(Time.deltaTime);
 }