using UnityEngine; namespace Artngame.SKYMASTER { public class FreezeBurnControlSKYMASTER : MonoBehaviour { private Color Start_color; public float freeze_ammount; public float burn_ammount; public float max_burn_ammount = 25f; public float max_freeze_ammount = 25f; public float Thaw_speed; public float Freeze_speed = 0.15f; public float check_time = 0.2f; public float current_time; private void Start() { if (GetComponent() != null) { Start_color = GetComponent().material.color; } } private void Update() { if (!(burn_ammount < max_burn_ammount / 2f)) { if (Time.fixedTime - current_time > check_time) { if (GetComponent() != null) { GetComponent().material.color = Color.Lerp(GetComponent().material.color, Color.black, Freeze_speed * Time.deltaTime); } } else { current_time = Time.fixedTime; } } if (freeze_ammount < max_freeze_ammount / 10f) { if (Thaw_speed > 0f) { if (Time.fixedTime - current_time > check_time) { if (GetComponent() != null && GetComponent().material.color != Start_color) { GetComponent().material.color = Color.Lerp(GetComponent().material.color, Start_color, Freeze_speed * Time.deltaTime); } } else { current_time = Time.fixedTime; } } } else if (Time.fixedTime - current_time > check_time) { if (GetComponent() != null) { GetComponent().material.color = Color.Lerp(GetComponent().material.color, Color.cyan, Freeze_speed * Time.deltaTime); } } else { current_time = Time.fixedTime; } if (Thaw_speed > 0f && freeze_ammount > 0f) { freeze_ammount -= Thaw_speed * Time.deltaTime; } } } }