public void Initialise_Agent(Agent_Type type, int cont_num = 0) { /*if (type == Agent_Type.Player && cont_num == 0) * { * throw new System.ArgumentException("Players cannot have a cont_num of 0: Initialise_Agent"); * }*/ // Initialise the AgentManager with all its default values based on type m_ControllerNumber = cont_num; m_StatCollector = new StatCollector(this); m_Type = type; //m_Powerup_State = null; switch (type) { case Agent_Type.Player: // Setup a player character m_Input = new Controller_Input(m_ControllerNumber); m_Strength = GLOBAL_VALUES.BASE_PLAYER_STRENGTH; m_MoveSpeed = GLOBAL_VALUES.BASE_PLAYER_MOVEMENT_SPEED; m_RotateSpeed = GLOBAL_VALUES.BASE_PLAYER_ROTATION_SPEED; m_Player_Nameplate = m_Instance.transform.Find("Player_Nameplate").gameObject; m_Player_Name_Text = m_Player_Nameplate.GetComponent <Text>(); m_Instance.GetComponent <AgentAnimations>().m_manager = this; // Set the Animation Manager m_Instance.GetComponent <AgentAnimations>().Setup(); m_Instance.GetComponent <AgentAnimations>().AnimEvent_TrailStop(); Hide_Name(); //m_Powerup_State = new AgentPowerups(this); m_Instance.transform.Find("Pickup_Box").gameObject.GetComponent <PickupBox>().Add_Agent(this); m_BadgeAllocation = "WINDOW_SHOPPER_" + m_Player_Number; break; case Agent_Type.Base_AI: // Base AI are calm, rotate slowly and move at random speeds m_Input = new BaseAI_Control(null, this); int random_speed = (int)(UnityEngine.Random.Range(GLOBAL_VALUES.BASE_PLAYER_MOVEMENT_SPEED * 0.7f, GLOBAL_VALUES.BASE_PLAYER_MOVEMENT_SPEED * 1.2f)); m_Strength = GLOBAL_VALUES.BASE_PLAYER_STRENGTH; m_MoveSpeed = random_speed; m_RotateSpeed = 10.0f; break; case Agent_Type.Large_AI: // Large AI move VERY slowly and rotate even slower m_Input = new LargeAI_Control(null, this); m_Strength = GLOBAL_VALUES.BASE_PLAYER_STRENGTH; m_MoveSpeed = GLOBAL_VALUES.BASE_PLAYER_MOVEMENT_SPEED * 0.3f; m_RotateSpeed = 2.0f; break; case Agent_Type.Security_AI: // Stronger than normal, rest is average m_Input = new SecurityAI_Control(null, this); m_Instance.GetComponentInChildren <SecurityItemVision>().m_Manager = this; m_Instance.GetComponent <SecurityAnimations>().m_manager = this; // Set the Animation Manager m_Instance.GetComponent <SecurityAnimations>().Setup(); m_Strength = GLOBAL_VALUES.BASE_PLAYER_STRENGTH * 1.1f; m_MoveSpeed = GLOBAL_VALUES.BASE_PLAYER_MOVEMENT_SPEED * 0.9f; m_RotateSpeed = GLOBAL_VALUES.BASE_PLAYER_ROTATION_SPEED; break; default: // setup a none character m_Input = new Input_Methods(cont_num); break; } m_Round_Score = 0; m_Round_Wins = 0; m_Sound_Source = m_Instance.GetComponent <AudioSource>(); m_Body = m_Instance.GetComponent <Rigidbody>(); m_Collision_Detector = m_Instance.GetComponent <CollisionDetection>(); m_Animator = m_Instance.GetComponent <Animator>(); m_State = Agent_State.Active; m_Enabled_State = Agent_Movement_State.Disabled; m_Animator.SetBool(GLOBAL_VALUES.ANIM_STUN_LOOP, false); m_Collision_Detector.Add_Manager(this); m_Actions = new AgentActions(this, m_Input); m_Movement = new AgentMovement(this, m_Input); if (isPlayer()) { // Players have extra things (UI and crown) GameObject StunCanvas = m_Instance.transform.Find("StunCanvas").gameObject; GameObject StunDuration = StunCanvas.transform.Find("StunDuration").gameObject; m_UI_Stun = StunCanvas.GetComponent <StunIndicatorUI>(); m_Crown = m_Instance.transform.Find("Crown").gameObject; m_Crown.SetActive(false); m_Round_Score_Position = 0; } else { m_UI_Stun = null; } if (isPlayer() || isSecurityAI()) { GetStunStars(); SetStunStars(false); } m_punchImpact = m_Instance.transform.Find("Impact_Punch").gameObject; m_throwImpact = m_Instance.transform.Find("Impact_Throw").gameObject; m_dashImpact = m_Instance.transform.Find("Impact_Dash").gameObject; m_Sound_Stun = Resources.Load <AudioClip>(GLOBAL_VALUES.SOUND_PLAYER_HIT); /* FIX * //m_Effect_Impact = m_Instance.transform.Find("Impact").gameObject; * //m_Effect_Stun_Lights = m_Instance.transform.Find("Player_Stun").gameObject; */ }