网演高层钦州
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.
 
 
 

51 lines
1.8 KiB

using AX.MessageSystem;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using AX.InputSystem;
using AX.NetworkSystem;
/// <summary>
/// 清理危险品杂物堆控制脚本
/// </summary>
public class ClearDangerous : MonoBehaviour {
public void OnEnable()
{
MessageDispatcher.AddListener("CLEAR_DANGEROUS_COMMAND", ClearDangerousExect);
}
public void OnDestroy()
{
MessageDispatcher.RemoveListener("CLEAR_DANGEROUS_COMMAND", ClearDangerousExect);
}
public void OnDisable()
{
MessageDispatcher.RemoveListener("CLEAR_DANGEROUS_COMMAND", ClearDangerousExect);
}
private void ClearDangerousExect(IMessage obj)
{
var info = (ForcibleEntryCmdArgs)obj.Data;
if (gameObject.GetComponent<CloneGameObjInfo>().gameObjID == info.gameObjID)
{
GameObject fireMan = EntitiesManager.Instance.GetEntityByID(info.fireManID);
if (Vector3.Distance(fireMan.transform.position, transform.position) < 3f)
{
EntitiesManager.Instance.DeleteObj(gameObject);
LoadPromptWin.Instance.LoadTextPromptWindow("清理成功", 1f);
//这里暂时用的是物品删除的同步
if (GameSettings.othersSettings.mode != Mode.DisasterManagement)
{
BaseNetworkSyncDate arg = new BaseNetworkSyncDate();
arg.SendUserID = CurrentUserInfo.mySelf.Id;
arg.gameObjID = gameObject.GetComponent<BaseGameObjInfo>().gameObjID;
NetworkManager.Default.SendAsync("OBJ_DELECT_SYNC", arg);
}
}
else
{
LoadPromptWin.Instance.LoadTextPromptWindow("请靠近危险品", 1f);
}
}
}
}