public void Get_Damage_Script(Damage_Control_Center_CS tempDamageScript) { // Called from "Damage_Control_Center_CS". damageScript = tempDamageScript; // Store the HP values. previousBodyHP = damageScript.MainBody_HP; previousTurretHP = damageScript.Turret_Props[0].hitPoints; previousLeftTrackHP = damageScript.Left_Track_HP; previousRightTrackHP = damageScript.Right_Track_HP; }
void Update_Traget_Information() { // Set the target transform. if (aimingScript.Target_Rigidbody) { currentTargetRigidbody = aimingScript.Target_Rigidbody; } else { currentTargetRigidbody = null; return; } // Get the "Damage_Control_Center_CS" in the target. targetDamageScript = currentTargetRigidbody.GetComponentInParent <Damage_Control_Center_CS>(); if (targetDamageScript == null) { return; } // Store the HP values. previousBodyHP = targetDamageScript.MainBody_HP; previousTurretHP = targetDamageScript.Turret_Props[0].hitPoints; previousLeftTrackHP = targetDamageScript.Left_Track_HP; previousRightTrackHP = targetDamageScript.Right_Track_HP; // Set the color. var targetIDScript = currentTargetRigidbody.GetComponentInParent <ID_Settings_CS>(); if (targetIDScript) { // Set the color according to the relationship. Color color = Color.white; switch (targetIDScript.Relationship) { case 0: // Friend. color = Friend_Color; break; case 1: // Hostile. color = Hostile_Color; break; } color.a = Normal_Alpha; // Change the color of all the images. Set_Color(bodyBarImages, color); Set_Color(turretBarImages, color); Set_Color(leftTrackBarImages, color); Set_Color(rightTrackBarImages, color); } }
protected virtual void Start() { centerScript = GetComponentInParent <Damage_Control_Center_CS>(); }