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.
59 lines
1.7 KiB
59 lines
1.7 KiB
using AX.MessageSystem; |
|
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class DangerousControl : ObjDoubleClick |
|
{ |
|
public bool isfage = false; |
|
public bool HaveFinish = false; |
|
public void Start() |
|
{ |
|
MessageDispatcher.AddListener("ReplayEvent", ReplayEventQingLi); |
|
} |
|
private void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("ReplayEvent", ReplayEventQingLi); |
|
} |
|
private void ReplayEventQingLi(IMessage obj) |
|
{ |
|
var eventData = (EventData)obj.Data; |
|
if (eventData.eventType == RecordEventType.QingLi) |
|
{ |
|
WeiXianPinData data = JsonUtility.FromJson<WeiXianPinData>(eventData.json); |
|
if (data.name == gameObject.name) |
|
{ |
|
WeiXianPinPanel.GetActiveInstance.QingLi(gameObject, data.index); |
|
WeiXianPinPanel.GetActiveInstance.SureBtn_Click(); |
|
} |
|
} |
|
} |
|
|
|
public override void ClickFunc() |
|
{ |
|
base.ClickFunc(); |
|
if (!isfage && !HaveFinish) |
|
{ |
|
bool Has = false; |
|
foreach (Transform child in GameObject.Find("P_AllParent/P_People/P_FireMan").transform) |
|
{ |
|
float distance = Vector3.Distance(child.transform.position, |
|
this.gameObject.transform.position); |
|
if (distance < 4f) |
|
{ |
|
Has = true; |
|
break; |
|
} |
|
} |
|
if (!Has) |
|
{ |
|
ResourceLoadWindow.Instance.LoadTextHintWindow("请消防员靠近清除", 1f); |
|
} |
|
else |
|
{ |
|
WeiXianPinPanel.GetActiveInstance.QingLi(gameObject); |
|
} |
|
} |
|
} |
|
}
|
|
|