private void Set_State(Agent_State new_state) { Leave_State(); m_State = new_state; switch (m_State) { case Agent_State.Active: { Unfreeze_Agent(); Unlock_A_Button(); Unlock_B_Button(); Unlock_X_Button(); Unlock_Analog(); if (isPlayer()) { Set_Move_Speed(GLOBAL_VALUES.BASE_PLAYER_MOVEMENT_SPEED); } else if (isSecurityAI()) { Set_Move_Speed(GLOBAL_VALUES.BASE_PLAYER_MOVEMENT_SPEED * 0.9f); } break; } case Agent_State.Stunned: { // Notify NotifySubscribers(AgentAction.GetStunned); // Drop item that youre carrying m_Actions.Drop(false); // Stop character m_Body.velocity = Vector3.zero; // Change the drag and physics settings of the agent m_Body.drag = GLOBAL_VALUES.PLAYER_STUNNED_DRAG; m_Body.angularDrag = GLOBAL_VALUES.PLAYER_STUNNED_ANGULARDRAG; m_Body.mass = GLOBAL_VALUES.PLAYER_STUNNED_MASS; // Set stun animations m_Animator.SetTrigger(GLOBAL_VALUES.ANIM_STUN_START); m_Animator.SetBool(GLOBAL_VALUES.ANIM_STUN_LOOP, true); if (m_Type == Agent_Type.Player) { //m_Actions.FindColourEffect("stun", m_Colour); m_UI_Stun.SetStunned(); } if (isPlayer() || isSecurityAI()) { SetStunStars(true); m_Stun_Stars_Active = m_Stun_Stars.Count - 1; m_Stun_Star_Time = m_Stun_Timer.Get_Time() / (m_Stun_Stars_Active); } //m_Instance.transform.Find("PlayerHitParticles").GetComponent<ParticleSystem>().Play(); if (m_Instance.CompareTag(GLOBAL_VALUES.TAG_PLAYER)) { foreach (ParticleSystem p in m_Instance.transform.Find("GroundSlam_Hold").GetComponentsInChildren <ParticleSystem>()) { p.Stop(); } foreach (ParticleSystem p in m_Instance.transform.Find("GroundSlam_Charge").GetComponentsInChildren <ParticleSystem>()) { p.Stop(); } } break; } default: { throw new System.NotImplementedException("State missing in AgentManager.Set_State(): [" + m_State + "]"); } } }