Beispiel #1
0
    // Update is called once per frame
    protected override void OnUpdate()
    {
        base.OnUpdate();

        if (m_fsm.IsInState <PlayerState_Dead>())
        {
            return;
        }

        if (HasAction)
        {
            EntityAction currentAction = CurrentAction;
            currentAction.m_durationLeft -= TimeManager.Dt;
            currentAction.m_durationLeft  = Mathf.Max(currentAction.m_durationLeft, 0.0f);

            if (currentAction.m_durationLeft == 0.0f)
            {
                if (currentAction.m_completedDelegate != null)
                {
                    currentAction.m_completedDelegate(currentAction);
                }
                currentAction = null;
            }

            CurrentAction = currentAction;
        }
    }