Пример #1
0
    // Basic State Functions
    public void Update()
    {
        // All States
        if (Enabled())
        {
            m_Movement.Update();
            m_Actions.Do_Actions();
            if (!isAnalogLocked())
            {
                m_Movement.Move();
            }

            /*
             * if(isPlayer())
             * {
             *  m_Powerup_State.Update();
             * }*/

            // State Specific
            switch (m_State)
            {
            case Agent_State.Active:
            {
                break;
            }

            case Agent_State.Stunned:
            {
                m_Stun_Timer.Update();
                m_StatCollector.Count_Stun(Time.deltaTime);
                if (isPlayer() || isSecurityAI())
                {
                    if (Math.Round(m_Stun_Star_Time * (m_Stun_Stars_Active), 1) == Math.Round(m_Stun_Timer.Get_Time(), 1))
                    {
                        try
                        {
                            if (m_Stun_Stars[m_Stun_Stars_Active].GetComponent <ParticleSystem>() != null)
                            {
                                m_Stun_Stars[m_Stun_Stars_Active].GetComponent <ParticleSystem>().Play();
                            }
                            m_Stun_Stars[m_Stun_Stars_Active].SetActive(false);
                            m_Stun_Stars_Active--;
                        }
                        catch
                        {
                            Debug.Log("Failed to disable Stun Stars: Found " + m_Stun_Stars_Active + "/" + m_Stun_Stars.Count);
                        }
                    }
                }
                if (m_Stun_Timer.isComplete())
                {
                    Set_State(Agent_State.Active);
                }
                break;
            }

            default:
            {
                throw new System.NotImplementedException("State missing in AgentManager.Update(): [" + m_State + "]");
            }
            }
            // All States
        }
    }