public void Change_AI_Settings(Event_Controller_CS Temp_Event_Script) // Called from "Event_Controller". { if (Temp_Event_Script) { // Change variables. WayPoint_Pack = Temp_Event_Script.New_WayPoint_Pack; Patrol_Type = Temp_Event_Script.New_Patrol_Type; Follow_Target = Temp_Event_Script.New_Follow_Target; No_Attack = Temp_Event_Script.New_No_Attack; // WayPoints settings. WayPoints_Settings(); // Follow_Target settings. if (Follow_Target) { Follow_Target_Settings(); } else { Next_WayPoint_Num = -1; Step = 1; Update_Next_WayPoint(); // Set the first waypoint. } // Action_Type = 0; Lost_Target(); } }
void Start() { // Case of spawning in event. Event_Controller_CS Event_Script = GetComponentInParent <Event_Controller_CS> (); if (Event_Script) // Overwritten by Event_Controller. { Tank_ID = Event_Script.Tank_ID; Relationship = Event_Script.Relationship; ReSpawn_Times = Event_Script.ReSpawn_Times; Attack_Multiplier = Event_Script.Attack_Multiplier; Input_Type = Event_Script.Input_Type; Turn_Type = Event_Script.Turn_Type; if (Event_Script.OverWrite_Flag) // Overwrite AI settings. { WayPoint_Pack = Event_Script.WayPoint_Pack; Patrol_Type = Event_Script.Patrol_Type; Follow_Target = Event_Script.Follow_Target; No_Attack = Event_Script.No_Attack; Visibility_Radius = Event_Script.Visibility_Radius; Approach_Distance = Event_Script.Approach_Distance; OpenFire_Distance = Event_Script.OpenFire_Distance; Lost_Count = Event_Script.Lost_Count; Face_Enemy = Event_Script.Face_Enemy; Face_Offest_Angle = Event_Script.Face_Offest_Angle; AI_State_Text = Event_Script.AI_State_Text; Default_Text_Color = Event_Script.Default_Text_Color; Tank_Name = Event_Script.Tank_Name; ReSpawn_Interval = Event_Script.ReSpawn_Interval; Remove_Time = Event_Script.Remove_Time; } } // Set_Tag(); // Find Game_Controller. GameObject Temp_Object = GameObject.Find("Game_Controller"); // Send this Transform, and Get Tank_ID. if (Temp_Object) { Game_Controller_Script = Temp_Object.GetComponent <Game_Controller_CS> (); if (Game_Controller_Script) { Tank_ID = Game_Controller_Script.Receive_ID(Tank_ID, this.transform); } } // Send settings to all parts. Send_Settings(); }
void Remove_Tank() { for (int i = 0; i < Target_Tanks.Length; i++) { // Delete Event_Controller_CS script. Event_Controller_CS Temp_Event_Script = Target_Tanks [i].GetComponentInChildren <Event_Controller_CS> (); if (Temp_Event_Script) { Destroy(Temp_Event_Script); } // Call "Remove_Tank()" in the Tank_ID_Control_CS script. Tank_ID_Control_CS Temp_Top_Script = Target_Tanks [i].GetComponentInChildren <Tank_ID_Control_CS> (); if (Temp_Top_Script) { Temp_Top_Script.StartCoroutine("Remove_Tank", 0.0f); } } if (Flag == false) { Destroy(this.gameObject); } }
void Change_AI_Settings() { for (int i = 0; i < Target_Tanks.Length; i++) { // for waiting AI tank. Event_Controller_CS Temp_Event_Script = Target_Tanks [i].GetComponentInChildren <Event_Controller_CS> (); if (Temp_Event_Script) { Temp_Event_Script.WayPoint_Pack = New_WayPoint_Pack; Temp_Event_Script.Patrol_Type = New_Patrol_Type; Temp_Event_Script.Follow_Target = New_Follow_Target; Temp_Event_Script.No_Attack = New_No_Attack; } // for living AI tank. AI_CS Temp_AI_Script = Target_Tanks [i].GetComponentInChildren <AI_CS> (); if (Temp_AI_Script) { Temp_AI_Script.Change_AI_Settings(this); } // for Respawn. Tank_ID_Control_CS Temp_Top_Script = Target_Tanks [i].GetComponentInChildren <Tank_ID_Control_CS> (); if (Temp_Top_Script) { Temp_Top_Script.WayPoint_Pack = New_WayPoint_Pack; Temp_Top_Script.Patrol_Type = New_Patrol_Type; Temp_Top_Script.Follow_Target = New_Follow_Target; Temp_Top_Script.No_Attack = New_No_Attack; if (Renew_ReSpawn_Times_Flag) { Temp_Top_Script.ReSpawn_Times = New_ReSpawn_Times; } } } if (Flag == false) { Destroy(this.gameObject); } }
void Variables_Settings() { Event_Controller_CS Event_Script = GetComponentInParent <Event_Controller_CS> (); if (Event_Script && Event_Script.OverWrite_Flag) // Use settings in Event_Controller. { WayPoint_Pack = Event_Script.WayPoint_Pack; Patrol_Type = Event_Script.Patrol_Type; Follow_Target = Event_Script.Follow_Target; No_Attack = Event_Script.No_Attack; Visibility_Radius = Event_Script.Visibility_Radius; Approach_Distance = Event_Script.Approach_Distance; OpenFire_Distance = Event_Script.OpenFire_Distance; Lost_Count = Event_Script.Lost_Count; Face_Enemy = Event_Script.Face_Enemy; Face_Offest_Angle = Event_Script.Face_Offest_Angle; AI_State_Text = Event_Script.AI_State_Text; Tank_Name = Event_Script.Tank_Name; Default_Text_Color = Event_Script.Default_Text_Color; } else // Use settings in Tank_ID_Control. { Tank_ID_Control_CS Top_Script = GetComponentInParent <Tank_ID_Control_CS> (); WayPoint_Pack = Top_Script.WayPoint_Pack; Patrol_Type = Top_Script.Patrol_Type; Follow_Target = Top_Script.Follow_Target; No_Attack = Top_Script.No_Attack; Visibility_Radius = Top_Script.Visibility_Radius; Approach_Distance = Top_Script.Approach_Distance; OpenFire_Distance = Top_Script.OpenFire_Distance; Lost_Count = Top_Script.Lost_Count; Face_Enemy = Top_Script.Face_Enemy; Face_Offest_Angle = Top_Script.Face_Offest_Angle; AI_State_Text = Top_Script.AI_State_Text; Tank_Name = Top_Script.Tank_Name; Default_Text_Color = Top_Script.Default_Text_Color; } }