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.
600 lines
25 KiB
600 lines
25 KiB
using UnityEngine; |
|
using System.Collections; |
|
using UnityEngine.UI; |
|
using AX.TrackRecord; |
|
using AX.MessageSystem; |
|
|
|
/// <summary> |
|
/// 爆炸控制 |
|
/// </summary> |
|
public class OilTankDisasterControl : MonoBehaviour |
|
{ |
|
public OilTank oilTank; |
|
public int StartTime = 0;//单位为分 |
|
public int HappenTime = 0;//单位为秒 |
|
public bool IsExplode; //是否爆炸 |
|
public bool IsTwist;//是否变形 |
|
private Slider slider; |
|
public GameObject Normal;//正常 |
|
private GameObject Twist;//变形扭曲 |
|
private GameObject Explosion;//爆炸 |
|
private GameObject Cap;//盖 |
|
|
|
private GameObject ExplosionEffect; |
|
private GameObject fire; |
|
public float thrust = 0f;//推力 |
|
public bool flag; |
|
public bool flag1; |
|
|
|
public float r; |
|
public float g; |
|
public float b; |
|
|
|
private float radius1 = 5.0f; |
|
private float radius2 = 8.0f; |
|
private float radius3 = 10.0f; |
|
private int count = 3; |
|
private Vector2 circle; |
|
private Vector3 randomPos; |
|
|
|
public bool happening;//是否在发生过程中 |
|
private RaycastHit hit; |
|
public GameObject messageBox; |
|
private string youGName;//油罐名称 |
|
private GameObject OilTankInfoImage; |
|
private GameObject ConfirmExplodeWin; |
|
private OilTank dataHelp = new OilTank(); |
|
public bool csRecordHappened;//true表示爆炸/变形发生完的初始记录情况 |
|
|
|
private GameObject FireY; |
|
// Use this for initialization |
|
GameObject ExplodeFire; |
|
public enum OilModleSence: int |
|
{ |
|
原名5场景=1, |
|
伏牛溪场景=2, |
|
卡贝乐场景=3 |
|
} |
|
OilModleSence oliSence = OilModleSence.原名5场景; |
|
|
|
void Awake()//Start() |
|
{ |
|
|
|
|
|
if (GameObject.Find("FuNiuXiYK") && GameObject.Find("FuNiuXiYK").activeInHierarchy) |
|
{ |
|
oliSence = OilModleSence.伏牛溪场景; |
|
} |
|
else if (GameObject.Find("5") && GameObject.Find("5").activeInHierarchy) |
|
{ |
|
oliSence = OilModleSence.原名5场景; |
|
} |
|
else if (GameObject.Find("kabeile_scenes") && GameObject.Find("kabeile_scenes").activeInHierarchy) |
|
{ |
|
oliSence = OilModleSence.卡贝乐场景; |
|
} |
|
|
|
|
|
MessageDispatcher.AddListener("SETOILTANK", Execute); |
|
MessageDispatcher.AddListener("TriggerOilTankProcess", OnTriggerOilTankProcess); |
|
|
|
OilTankInfoImage = GameObject.Find("Canvas").transform.Find("OilTankInfoImage").gameObject; |
|
ConfirmExplodeWin = GameObject.Find("Canvas").transform.Find("ConfirmExplodeWin").gameObject; |
|
messageBox = GameObject.Find("Canvas").transform.Find("MessageBox").gameObject; |
|
|
|
slider = this.GetComponent<Slider>(); |
|
ExplosionEffect = Resources.Load<GameObject>("Prefabs/ZQPrefab/WFX_Nuke"); |
|
fire = Resources.Load<GameObject>("Prefabs/ZQPrefab/GroundFire_OilTank"); |
|
|
|
if (this.transform.parent.parent.name == "QiuXingGuan") |
|
{ |
|
//youGName = this.transform.parent.parent.FindChild("QiuGuan").name; |
|
//Normal = this.transform.parent.parent.FindChild("QiuGuan").gameObject; |
|
youGName = Normal.name; |
|
Twist = this.transform.parent.parent.Find("QG_Twist").gameObject; |
|
Explosion = this.transform.parent.parent.Find("QG_Exp").gameObject; |
|
Cap = Explosion.transform.Find("QG_G").gameObject; |
|
} |
|
|
|
if (this.transform.parent.parent.name == "FuDingGuan") |
|
{ |
|
//youGName = this.transform.parent.parent.FindChild("WaiFuDingGuan").name; |
|
//Normal = this.transform.parent.parent.FindChild("WaiFuDingGuan").gameObject; |
|
youGName = Normal.name; |
|
Twist = this.transform.parent.parent.Find("WFDG_Twist").gameObject; |
|
Explosion = this.transform.parent.parent.Find("WFDG_Exp").gameObject; |
|
Cap = Explosion.transform.Find("XF_WFDG_0").gameObject; |
|
} |
|
|
|
if (this.transform.parent.parent.name == "GongDingG") |
|
{ |
|
//youGName = this.transform.parent.parent.FindChild("GongDingGuan").name; |
|
//Normal = this.transform.parent.parent.FindChild("GongDingGuan").gameObject; |
|
youGName = Normal.name; |
|
Twist = this.transform.parent.parent.Find("GDG_Twist").gameObject; |
|
Explosion = this.transform.parent.parent.Find("GDG_Exp").gameObject; |
|
Cap = Explosion.transform.Find("GongDingGuanGaiZi_Explode").gameObject; |
|
|
|
///伏牛溪FireY |
|
if ((int)oliSence == 2 || (int)oliSence == 3) |
|
{ |
|
FireY = this.transform.parent.parent.Find("FireY").gameObject; |
|
} |
|
|
|
} |
|
} |
|
|
|
void Execute(IMessage msg) |
|
{ |
|
if ((string)msg.Sender == Normal.name) |
|
{ |
|
oilTank = (OilTank)msg.Data; |
|
|
|
LoadOilTankData(); |
|
|
|
if (!(ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditQuestion |
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CopyQuestion)) |
|
{ |
|
if ((IsExplode || IsTwist) && HappenTime != 0) |
|
{ |
|
if ((int)oilTank.CanvasSliderValue == 0) |
|
{//还没发生 |
|
StartCoroutine(WaitSenconds(StartTime * 60f)); |
|
} |
|
else |
|
{//发生一半 |
|
slider.value = (int)oilTank.CanvasSliderValue; |
|
r = oilTank.OilTankColor.x; |
|
g = oilTank.OilTankColor.y; |
|
b = oilTank.OilTankColor.z; |
|
|
|
StartCoroutine(WaitSenconds(StartTime * 0f)); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
public void LoadOilTankData() |
|
{ |
|
if (this.transform.parent.parent.name == "QiuXingGuan") |
|
{ |
|
thrust = 1000f; |
|
|
|
//Normal = this.transform.parent.parent.FindChild("QiuGuan").gameObject; |
|
|
|
//oilTank = Normal.GetComponent<ShowOilTankDisasterSetWin>().oilTank; |
|
StartTime = oilTank.StartTime; |
|
HappenTime = oilTank.HappenTime; |
|
slider.maxValue = HappenTime; |
|
IsExplode = oilTank.IsExplode; |
|
IsTwist = oilTank.IsTwist; |
|
|
|
//Twist = this.transform.parent.parent.FindChild("QG_Twist").gameObject; |
|
//Explosion = this.transform.parent.parent.FindChild("QG_Exp").gameObject; |
|
//Cap = Explosion.transform.FindChild("QG_G").gameObject; |
|
} |
|
|
|
if (this.transform.parent.parent.name == "FuDingGuan") |
|
{ |
|
thrust = 14000f; |
|
|
|
//Normal = this.transform.parent.parent.FindChild("WaiFuDingGuan").gameObject; |
|
|
|
//oilTank = Normal.GetComponent<ShowOilTankDisasterSetWin>().oilTank; |
|
StartTime = oilTank.StartTime; |
|
HappenTime = oilTank.HappenTime; |
|
slider.maxValue = HappenTime; |
|
IsExplode = oilTank.IsExplode; |
|
IsTwist = oilTank.IsTwist; |
|
|
|
//Twist = this.transform.parent.parent.FindChild("WFDG_Twist").gameObject; |
|
//Explosion = this.transform.parent.parent.FindChild("WFDG_Exp").gameObject; |
|
//Cap = Explosion.transform.FindChild("XF_WFDG_0").gameObject; |
|
} |
|
|
|
if (this.transform.parent.parent.name == "GongDingG") |
|
{ |
|
thrust = 1500f; |
|
|
|
//Normal = this.transform.parent.parent.FindChild("GongDingGuan").gameObject; |
|
|
|
//oilTank = Normal.GetComponent<ShowOilTankDisasterSetWin>().oilTank; |
|
StartTime = oilTank.StartTime; |
|
HappenTime = oilTank.HappenTime; |
|
slider.maxValue = HappenTime; |
|
IsExplode = oilTank.IsExplode; |
|
IsTwist = oilTank.IsTwist; |
|
|
|
//Twist = this.transform.parent.parent.FindChild("GDG_Twist").gameObject; |
|
//Explosion = this.transform.parent.parent.FindChild("GDG_Exp").gameObject; |
|
//Cap = Explosion.transform.FindChild("GongDingGuanGaiZi_Explode").gameObject; |
|
} |
|
} |
|
|
|
void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("SETOILTANK", Execute); |
|
MessageDispatcher.RemoveListener("TriggerOilTankProcess", OnTriggerOilTankProcess); |
|
} |
|
|
|
IEnumerator WaitSenconds(float delay) |
|
{ |
|
yield return new WaitForSeconds(delay); |
|
|
|
if (!happening) |
|
{ |
|
happening = true; |
|
|
|
InvokeRepeating("ExplodeCtrl", 1f, 1f); |
|
} |
|
} |
|
|
|
private void ExplodeCtrl() |
|
{ |
|
slider.value++; |
|
r = r + 1f / HappenTime; |
|
g = g + 1f / HappenTime; |
|
b = b + 1f / HappenTime; |
|
|
|
if (Normal != null && Normal.transform.parent.name == "QiuXingGuan") |
|
{ |
|
Normal.transform.Find("XF_QGGT_0").GetComponent<Renderer>().material.SetColor("_EmissionColor", |
|
new Color(r, g, b)); |
|
} |
|
|
|
if (Normal != null && Normal.transform.parent.name == "FuDingGuan") |
|
{ |
|
Normal.transform.Find("XF_WFDGT_0").GetComponent<Renderer>().material.SetColor("_EmissionColor", |
|
new Color(r, g, b)); |
|
} |
|
|
|
if (Normal != null && Normal.transform.parent.name == "GongDingG") |
|
{ |
|
if ((int)oliSence == 1) |
|
{ |
|
Normal.transform.Find("guanbi").GetComponent<Renderer>().material.SetColor("_EmissionColor", |
|
new Color(r, g, b)); |
|
Normal.transform.Find("guanding").GetComponent<Renderer>().material.SetColor("_EmissionColor", |
|
new Color(r, g, b)); |
|
} |
|
} |
|
|
|
dataHelp.CanvasSliderValue = slider.value; |
|
dataHelp.OilTankColor = new Vector3(r,g,b); |
|
if (RecordManager.Instance.IsRecording) |
|
{ |
|
MessageDispatcher.SendMessage((object)Normal.name, "RecordOilTankTimerEvent", dataHelp); |
|
} |
|
} |
|
|
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
//创建考题,备课中新建课件,自学 |
|
if (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CreatQuestion |
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditQuestion |
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CopyQuestion |
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.PrepareMode |
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditCourceware |
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.SelfStudyMode) |
|
{ |
|
//新建节点,既没有新建节点也没有加载节点两种情况下允许按F5设置开始爆炸(加载节点不允许按F5设置开始爆炸) |
|
if (RecordManager.Instance.IsRecording |
|
|| (!RecordManager.Instance.IsRecording && !LoadManager.Instance.IsPlayBacking)) |
|
{ |
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); |
|
|
|
if (Physics.Raycast(ray, out hit, Mathf.Infinity)) |
|
{ |
|
if (hit.transform.parent.name == youGName) |
|
{ |
|
if (Input.GetKeyDown(KeyCode.F5)) |
|
{ |
|
if (!happening) |
|
{ |
|
if (!flag) |
|
{ |
|
if (!Normal.GetComponent<ShowOilTankDisasterSetWin>().oilTank.IsExplode |
|
&& !Normal.GetComponent<ShowOilTankDisasterSetWin>().oilTank.IsTwist) |
|
{ |
|
messageBox.GetComponent<MessageTool>().showMessage(ShowMessageType.prompt, "提示信息", "还没设置爆炸或变形"); |
|
} |
|
else |
|
{ |
|
OilTankInfoImage.SetActive(false); |
|
|
|
ConfirmExplodeWin.SetActive(true); |
|
ConfirmExplodeWin.transform.Find("ConfirmButton").GetComponent<ComfirmExplode>().youGuan = this.gameObject; |
|
} |
|
} |
|
else |
|
{ |
|
messageBox.GetComponent<MessageTool>().showMessage(ShowMessageType.prompt, "提示信息", "爆炸或变形已经发生过了"); |
|
} |
|
} |
|
else |
|
{ |
|
messageBox.GetComponent<MessageTool>().showMessage(ShowMessageType.prompt, "提示信息", "已经开始填充危险条"); |
|
} |
|
} |
|
} |
|
} |
|
|
|
if (happening) |
|
{ |
|
if (!flag1) |
|
{ |
|
//加载设置的油罐属性 |
|
oilTank = Normal.GetComponent<ShowOilTankDisasterSetWin>().oilTank; |
|
LoadOilTankData(); |
|
|
|
if (HappenTime != 0) |
|
{ |
|
InvokeRepeating("ExplodeCtrl", 1f, 1f); |
|
} |
|
|
|
flag1 = true; |
|
} |
|
|
|
if (HappenTime != 0 && slider.value == HappenTime) |
|
{ |
|
if (!flag) |
|
{ |
|
if (IsExplode) |
|
{ |
|
CancelInvoke("ExplodeCtrl"); |
|
|
|
Normal.SetActive(false); |
|
AudioManager.Instance.Play(BoomType.Expolsion); |
|
Explosion.SetActive(true); |
|
|
|
Instantiate(ExplosionEffect, Cap.transform.position, Quaternion.identity); |
|
Cap.GetComponent<Rigidbody>().AddForce(Cap.transform.up * thrust); |
|
///伏牛溪 |
|
if ((int)oliSence == 2 || (int)oliSence == 3) |
|
{ |
|
ExplodeFire = Instantiate(fire, |
|
new Vector3(Explosion.transform.position.x, FireY.transform.position.y, Explosion.transform.position.z), |
|
Quaternion.identity, |
|
GameObject.Find("AllParent").transform.Find("pfire")) as GameObject; |
|
} |
|
else if ((int)oliSence == 1) |
|
{ |
|
ExplodeFire = Instantiate(fire, |
|
new Vector3(Explosion.transform.position.x, Explosion.transform.position.y + 1.5f, Explosion.transform.position.z), |
|
Quaternion.identity, |
|
GameObject.Find("AllParent").transform.Find("pfire")) as GameObject; |
|
} |
|
|
|
|
|
|
|
//var explodedFire = ExplodeFire.AddComponent<ExplodeFire>(); |
|
var explodedFire = ExplodeFire.GetComponent<ExplodeFire>(); |
|
ExplodeFire.name = "中队名" + "-" + "fire" + "-" + "GroundFire_OilTank" + "-" + Normal.name+ "-" + TrackRecordHelpClass.GetFileNameAccordingTime(System.DateTime.Now) + (count + 1); |
|
if (RecordManager.Instance.IsRecording)//记录爆炸/变形产生的火实例化的事件 |
|
{ |
|
MessageDispatcher.SendMessage("RecordInstantiateEvent", (object)ExplodeFire.name); |
|
} |
|
explodedFire.youGuan = Normal; |
|
|
|
RandomCloneFire(); |
|
} |
|
|
|
if (IsTwist) |
|
{ |
|
CancelInvoke("ExplodeCtrl"); |
|
|
|
Normal.SetActive(false); |
|
AudioManager.Instance.Play(BoomType.Twist); |
|
Twist.SetActive(true); |
|
} |
|
|
|
flag = true; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
//培训事件型记录情况下加载时 |
|
if (LoadManager.Instance.IsPlayBacking) |
|
{ |
|
if (HappenTime != 0 && slider.value == HappenTime) |
|
{ |
|
if (!csRecordHappened)//排除备课爆炸完初始记录情况回放时触发爆炸特效 |
|
{ |
|
if (!flag) |
|
{ |
|
if (IsExplode) |
|
{ |
|
//CancelInvoke("ExplodeCtrl"); |
|
|
|
Normal.SetActive(false); |
|
AudioManager.Instance.Play(BoomType.Expolsion); |
|
Explosion.SetActive(true); |
|
|
|
Instantiate(ExplosionEffect, Cap.transform.position, Quaternion.identity); |
|
Cap.GetComponent<Rigidbody>().AddForce(Cap.transform.up * thrust); |
|
//GameObject ExplodeFire = Instantiate(fire, |
|
// new Vector3(Explosion.transform.position.x, Explosion.transform.position.y + 1.5f, Explosion.transform.position.z), |
|
// Quaternion.identity, |
|
// GameObject.Find("AllParent").transform.FindChild("pfire")) as GameObject; |
|
//var explodedFire = ExplodeFire.AddComponent<ExplodeFire>(); |
|
//var explodedFire = ExplodeFire.GetComponent<ExplodeFire>(); |
|
//explodedFire.youGuan = Normal; |
|
|
|
//RandomCloneFire(); |
|
} |
|
|
|
if (IsTwist) |
|
{ |
|
//CancelInvoke("ExplodeCtrl"); |
|
|
|
Normal.SetActive(false); |
|
Twist.SetActive(true); |
|
AudioManager.Instance.Play(BoomType.Twist); |
|
} |
|
|
|
flag = true; |
|
} |
|
} |
|
} |
|
} |
|
|
|
//考试时加载考题 |
|
if (happening) |
|
{ |
|
if (HappenTime != 0 && slider.value == HappenTime) |
|
{ |
|
if (!flag) |
|
{ |
|
if (IsExplode) |
|
{ |
|
CancelInvoke("ExplodeCtrl"); |
|
|
|
Normal.SetActive(false); |
|
AudioManager.Instance.Play(BoomType.Expolsion); |
|
Explosion.SetActive(true); |
|
|
|
Instantiate(ExplosionEffect, Cap.transform.position, Quaternion.identity); |
|
Cap.GetComponent<Rigidbody>().AddForce(Cap.transform.up * thrust); |
|
GameObject ExplodeFire = Instantiate(fire, |
|
new Vector3(Explosion.transform.position.x, Explosion.transform.position.y + 1.5f, Explosion.transform.position.z), |
|
Quaternion.identity, |
|
GameObject.Find("AllParent").transform.Find("pfire")) as GameObject; |
|
//var explodedFire = ExplodeFire.AddComponent<ExplodeFire>(); |
|
var explodedFire = ExplodeFire.GetComponent<ExplodeFire>(); |
|
ExplodeFire.name = "中队名" + "-" + "fire" + "-" + "GroundFire_OilTank" + "-" + Normal.name + "-" + TrackRecordHelpClass.GetFileNameAccordingTime(System.DateTime.Now) + (count + 1); |
|
explodedFire.youGuan = Normal; |
|
|
|
RandomCloneFire(); |
|
} |
|
|
|
if (IsTwist) |
|
{ |
|
CancelInvoke("ExplodeCtrl"); |
|
|
|
Normal.SetActive(false); |
|
Twist.SetActive(true); |
|
AudioManager.Instance.Play(BoomType.Twist); |
|
} |
|
|
|
flag = true; |
|
} |
|
} |
|
} |
|
} |
|
|
|
public void RandomCloneFire() |
|
{ |
|
for (int i = 0; i < count; i++) |
|
{ |
|
if (Normal != null && Normal.transform.parent.name == "QiuXingGuan") |
|
circle = Random.insideUnitCircle * radius1; |
|
if (Normal != null && Normal.transform.parent.name == "FuDingGuan") |
|
circle = Random.insideUnitCircle * radius2; |
|
if (Normal != null && Normal.transform.parent.name == "GongDingG") |
|
//circle = Random.insideUnitCircle * radius3; |
|
circle = Random.insideUnitCircle * Normal.transform.GetComponent<ShowOilTankDisasterSetWin>().radius; |
|
if ((int)oliSence==2|| (int)oliSence == 3) |
|
{ |
|
randomPos = new Vector3(Explosion.transform.position.x + circle.x, |
|
FireY.transform.position.y, |
|
Explosion.transform.position.z + circle.y); |
|
} |
|
else if ((int)oliSence == 1) |
|
{ |
|
randomPos = new Vector3(Explosion.transform.position.x + circle.x, |
|
Explosion.transform.position.y + 1.5f, |
|
Explosion.transform.position.z + circle.y); |
|
} |
|
GameObject ExplodeFire = Instantiate(fire, randomPos, Quaternion.identity, GameObject.Find("AllParent").transform.Find("pfire")) as GameObject; |
|
//var explodedFire = ExplodeFire.AddComponent<ExplodeFire>(); |
|
var explodedFire = ExplodeFire.GetComponent<ExplodeFire>(); |
|
ExplodeFire.name = "中队名" + "-" + "fire" + "-" + "GroundFire_OilTank" + "-" + Normal.name + "-" + TrackRecordHelpClass.GetFileNameAccordingTime(System.DateTime.Now) + i; |
|
if (RecordManager.Instance.IsRecording)//记录爆炸/变形产生的火实例化的事件 |
|
{ |
|
MessageDispatcher.SendMessage("RecordInstantiateEvent", (object)ExplodeFire.name); |
|
} |
|
explodedFire.youGuan = Normal; |
|
} |
|
} |
|
|
|
//油罐初始记录情况下(包括备课,考题初始记录两种情况),爆炸/变形发生完了的情况,回放对油罐的处理(爆炸情况下盖子在回放逻辑那边处理,火按记录情况回放) |
|
public void InitializationRecordBackPlay() |
|
{ |
|
oilTank = Normal.GetComponent<ShowOilTankDisasterSetWin>().oilTank; |
|
|
|
if (oilTank.IsExplode) |
|
{ |
|
Normal.SetActive(false); |
|
AudioManager.Instance.Play(BoomType.Expolsion); |
|
Explosion.SetActive(true); |
|
|
|
slider.value = oilTank.HappenTime; |
|
} |
|
|
|
if (oilTank.IsTwist) |
|
{ |
|
Normal.SetActive(false); |
|
Twist.SetActive(true); |
|
AudioManager.Instance.Play(BoomType.Twist); |
|
|
|
slider.value = oilTank.HappenTime; |
|
} |
|
} |
|
|
|
//油罐初始记录情况下(包括备课,考题初始记录两种情况),爆炸/变形还没发生或者发生一半的情况,回放对油罐的处理 |
|
private void OnTriggerOilTankProcess(IMessage msg) |
|
{ |
|
if ((string)msg.Data == Normal.name) |
|
{ |
|
oilTank = Normal.GetComponent<ShowOilTankDisasterSetWin>().oilTank; |
|
|
|
if (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.ExamineMode) |
|
{//考试加载考题,需要接着触发过程 |
|
if ((int)oilTank.CanvasSliderValue != oilTank.HappenTime) |
|
{ |
|
MessageDispatcher.SendMessage((string)msg.Data, "SETOILTANK", oilTank); |
|
} |
|
} |
|
else |
|
{//备课等其他情况加载, 不需要接着触发过程,只需还原记录的状态 |
|
if ((int)oilTank.CanvasSliderValue != 0) |
|
{//发生一半(还没发生不用处理) |
|
slider.value = oilTank.CanvasSliderValue; |
|
|
|
if (Normal != null && Normal.transform.parent.name == "QiuXingGuan") |
|
{ |
|
Normal.transform.Find("XF_QGGT_0").GetComponent<Renderer>().material.SetColor("_EmissionColor", |
|
new Color(oilTank.OilTankColor.x, oilTank.OilTankColor.y, oilTank.OilTankColor.z)); |
|
} |
|
|
|
if (Normal != null && Normal.transform.parent.name == "FuDingGuan") |
|
{ |
|
Normal.transform.Find("XF_WFDGT_0").GetComponent<Renderer>().material.SetColor("_EmissionColor", |
|
new Color(oilTank.OilTankColor.x, oilTank.OilTankColor.y, oilTank.OilTankColor.z)); |
|
} |
|
|
|
if (Normal != null && Normal.transform.parent.name == "GongDingG") |
|
{ |
|
Normal.transform.Find("guanbi").GetComponent<Renderer>().material.SetColor("_EmissionColor", |
|
new Color(oilTank.OilTankColor.x, oilTank.OilTankColor.y, oilTank.OilTankColor.z)); |
|
Normal.transform.Find("guanding").GetComponent<Renderer>().material.SetColor("_EmissionColor", |
|
new Color(oilTank.OilTankColor.x, oilTank.OilTankColor.y, oilTank.OilTankColor.z)); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
//备课初始记录时还没开始填充危险条或已经填充一部分就保存节点,再加载节点时要停调等待时间方法和填充危险条方法。 |
|
//避免这种情况加载后依然继续发生 |
|
public void StopTrigger() |
|
{ |
|
StopAllCoroutines(); |
|
CancelInvoke("ExplodeCtrl"); |
|
} |
|
}
|
|
|