void Start() { This_Transform = transform; Game_Controller_Script = FindObjectOfType <Game_Controller_CS> (); if (Game_Controller_Script == null) { Debug.LogError("There is no 'Game_Controller' in the scene. (Physics Tank Maker)"); Destroy(this); } // Set and store the 'Camera_Positions'. Set_Camera_Positions(); }
void Start() { This_Transform = transform; Parent_Transform = This_Transform.parent; // Variables settings. Variables_Settings(); // Find "AI_Eye" if (Eye_Transform == null) { Eye_Transform = This_Transform.Find("AI_Eye"); // Do not rename "AI_Eye". if (Eye_Transform == null) { Debug.LogError("'AI_Eye' can not be found. (Physics Tank Maker"); } } // Find AI_Hand_CS script. Hand_Script = This_Transform.GetComponentInChildren <AI_Hand_CS> (); if (Hand_Script == null) { Debug.LogError("'AI_Hand' can not be found. (Physics Tank Maker"); } // Find Game_Controller. Game_Controller_Script = FindObjectOfType <Game_Controller_CS> (); if (Game_Controller_Script == null) { Debug.LogError("'Game_Controller' can not be found. (Physics Tank Maker"); } // NavMeshAgent settings. Initial_Position = This_Transform.localPosition; // for fixing this object on its default position. This_Agent = GetComponent <NavMeshAgent> (); // Text settings. if (AI_State_Text) { if (string.IsNullOrEmpty(Tank_Name)) { Tank_Name = This_Transform.root.name; } Text_Update("Search", Default_Text_Color); } // WayPoints settings. WayPoints_Settings(); // Follow_Target settings. if (Follow_Target) { Follow_Target_Settings(); } else { Update_Next_WayPoint(); // Set the first waypoint. } // Send this script to "Turret_Horizontal", "Cannon_Vertical", "Drive_Control", "Steer_Wheel". Parent_Transform.BroadcastMessage("Get_AI", this, SendMessageOptions.DontRequireReceiver); }
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(); }