コード例 #1
0
        void Start()
        {
            // Get the reticle image in the scene.
            if (string.IsNullOrEmpty(Reticle_Name))
            {
                return;
            }
            GameObject reticleObject = GameObject.Find(Reticle_Name);

            if (reticleObject)
            {
                reticleImage = reticleObject.GetComponent <Image>();
            }
            if (reticleImage == null)
            {
                Debug.LogWarning(Reticle_Name + " cannot be found in the scene.");
                Destroy(this);
            }

            // Get the "Gun_Camera_CS" script in the tank.
            if (Gun_Camera_Script == null)
            {
                Gun_Camera_Script = GetComponent <Gun_Camera_CS>();
            }
        }
        public override void Prepare(Aiming_Control_CS aimingScript)
        {
            this.aimingScript = aimingScript;

            // Set the "Use_Auto_Turn".
            aimingScript.Use_Auto_Turn = true;

            // Get the "Gun_Camera_CS".
            gunCameraScript = GetComponentInChildren <Gun_Camera_CS>();

            // Set the relationship.
            ID_Settings_CS idScript = GetComponentInParent <ID_Settings_CS>();

            if (idScript)
            {
                thisRelationship = idScript.Relationship;
            }

            // Set the initial aiming mode.
            aimingScript.Mode = 1; // Free aiming.
            aimingScript.Switch_Mode();

            // Set the initial target position.
            aimingScript.Target_Position = transform.position + (transform.forward * 128.0f);
        }
コード例 #3
0
 public void Prepare(Gun_Camera_CS gunCameraScript)
 {
     this.gunCameraScript = gunCameraScript;
 }