void Store_Components(Transform Temp_Transform) // Store MainBody's transform and sctipt ,and AI scripts. { MainBody_Setting_CS Temp_MainBodyScript = Temp_Transform.GetComponentInChildren <MainBody_Setting_CS> (); if (Temp_MainBodyScript) { if (Temp_Transform.root.tag == "Player") // Friendly tank. { for (int i = 0; i < Friendly_Body_Transforms.Length; i++) // Search empty. { if (Friendly_Body_Transforms [i] == null) { // Store components. Friendly_Body_Transforms [i] = Temp_MainBodyScript.transform; Friendly_Body_Scripts [i] = Temp_MainBodyScript; AI_CS Temp_AI_Script = Friendly_Body_Transforms [i].GetComponentInChildren <AI_CS> (); if (Temp_AI_Script) { Friendly_AI_Scripts [i] = Temp_AI_Script; } break; } } } else if (Temp_Transform.root.tag != "Finish") // Hostile tank. { for (int i = 0; i < Hostile_Body_Transforms.Length; i++) // Search empty. { if (Hostile_Body_Transforms [i] == null) { // Store components. Hostile_Body_Transforms [i] = Temp_MainBodyScript.transform; Hostile_Body_Scripts [i] = Temp_MainBodyScript; AI_CS Temp_AI_Script = Hostile_Body_Transforms [i].GetComponentInChildren <AI_CS> (); if (Temp_AI_Script) { Hostile_AI_Scripts [i] = Temp_AI_Script; } break; } } } } else { Debug.LogWarning("'Game_Controller' cannot find the MainBody of '" + Temp_Transform.name + "'. (Physics Tank Maker)"); } }
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 Get_AI(AI_CS Temp_Script) { AI_Script = Temp_Script; }
void Get_AI(AI_CS Temp_Script) { Bullet_Type = Temp_Script.Bullet_Type; }