예제 #1
0
        void Initialize()
        {
            Is_Working = false;

            // Get the "AI_CS".
            aiScript = GetComponentInParent <AI_CS>();

            // Set the layer.
            gameObject.layer = 2; // "Ignore Raycast" layer.

            // Make this gameobject invisible.
            var renderer = GetComponent <Renderer>();

            if (renderer)
            {
                renderer.enabled = false;
            }

            // Make this collider a trigger.
            var collider = GetComponent <Collider>();

            if (collider)
            {
                collider.isTrigger = true;
            }

            // Get the "Drive_Control_CS".
            driveControlScript = GetComponentInParent <Drive_Control_CS>();

            // Get the initial position and scale.
            thisTransform = transform;
            currentPos    = thisTransform.localPosition;
            initialPosZ   = currentPos.z;
            currentScale  = thisTransform.localScale;
        }
        public override void Prepare(Drive_Control_CS controlScript)
        {
            // Store the reference to "Drive_Control_CS".
            this.controlScript = controlScript;

            // Store the reference to "AI_CS".
            aiScript = GetComponentInChildren <AI_CS>();
        }
        public override void Prepare(Cannon_Fire_CS cannoFireScript)
        {
            this.cannonFireScript = cannoFireScript;

            aiScript     = transform.root.GetComponentInChildren <AI_CS>();
            turretScript = GetComponentInParent <Turret_Horizontal_CS>();
            cannonScript = GetComponent <Cannon_Vertical_CS>();
            aimingScript = GetComponentInParent <Aiming_Control_CS>();
        }
        // << User options


        public void Changed_By_Event()
        { // Called from "Event_Event_03_Change_AI_Settings_CS" script, when the event occurs.
            // Call "AI_CS" in the tank to reset the settings.
            AI_CS aiScript = GetComponentInChildren <AI_CS>();

            if (aiScript)
            {
                aiScript.Reset_Settings();
            }
        }
 public void Get_AI_Script(AI_CS aiScript)
 { // Called form "AI_CS" in the AI tanks in the scene.
     this.aiScript   = aiScript;
     aiRootTransform = aiScript.transform.root;
     if (string.IsNullOrEmpty(aiScript.Settings_Script.Tank_Name))
     {
         aiScript.Settings_Script.Tank_Name = aiRootTransform.name;
     }
     respawnScript = aiScript.GetComponentInParent <Respawn_Controller_CS>();
     textFormat    = aiScript.Settings_Script.Tank_Name + " = " + "{0}" + " {1}";
 }
예제 #6
0
        public override void Prepare(Steer_Wheel_CS steerScript)
        {
            this.steerScript = steerScript;

            aiScript = transform.root.GetComponentInChildren <AI_CS>();
        }
예제 #7
0
 void Get_Components()
 {         // This function is called at the fisrst time, and also when the tank is respawned.
     ID_Script      = GetComponent <ID_Settings_CS>();
     Body_Transform = GetComponentInChildren <Rigidbody>().transform;
     AI_Script      = GetComponentInChildren <AI_CS>();
 }
 void Get_AI_CS(AI_CS aiScript)
 { // Called from "AI_CS".
     this.aiScript = aiScript;
 }