You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
58 lines
1.3 KiB
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class OilTanksCooling : MonoBehaviour |
|
{ |
|
//是否受热中 |
|
public bool IsHeating = false; |
|
// 是否发生灾情 |
|
public bool IsOver = false; |
|
// 是否冷却中 |
|
public bool IsCooling = false; |
|
// 冷却检查时间 |
|
public float coolingCheckedTime = 1f; |
|
// |
|
public GameObject CoolingObject; |
|
|
|
|
|
public void SetCoolingObject() |
|
{ |
|
if (CoolingObject != null && GameSettings.othersSettings.mode== Mode.Practice) |
|
{ |
|
CoolingObject.SetActive(IsCooling); |
|
} |
|
} |
|
private void CheckedIsCooling() |
|
{ |
|
if (IsCooling) |
|
{ |
|
coolingCheckedTime -= Time.deltaTime; |
|
if (coolingCheckedTime <= 0) |
|
{ |
|
IsCooling = false; |
|
} |
|
//Debug.Log(gameObject.name + "冷却中"); |
|
} |
|
//else |
|
//{ |
|
// Debug.Log(gameObject.name + "未冷却"); |
|
//} |
|
} |
|
private void Update() |
|
{ |
|
if (IsHeating && !IsOver) |
|
{ |
|
CheckedIsCooling(); |
|
} |
|
} |
|
void OnParticleCollision(GameObject other) |
|
{ |
|
if (other.name == "WaterStraight") |
|
{ |
|
IsCooling = true; |
|
coolingCheckedTime = 1f; |
|
} |
|
} |
|
}
|
|
|