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.
111 lines
2.9 KiB
111 lines
2.9 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using AX.MessageSystem; |
|
using System; |
|
using AX.InputSystem; |
|
|
|
public class ParentLayWaterHoseMsg : MonoBehaviour |
|
{ |
|
public string EquipId = "82"; |
|
/// <summary> |
|
/// 本次铺设使用的盘数 |
|
/// </summary> |
|
public int UseNum; |
|
/// <summary> |
|
/// 剩余可用长度 |
|
/// </summary> |
|
public float RemainLenght; |
|
/// <summary> |
|
/// 创建者 |
|
/// </summary> |
|
public GameObject CreatFireman; |
|
/// <summary> |
|
/// 水带长度 |
|
/// </summary> |
|
public float LineLenght; |
|
/// <summary> |
|
/// 是否有水 |
|
/// </summary> |
|
public bool ConnectWater; |
|
/// <summary> |
|
/// 是否有泡沫 |
|
/// </summary> |
|
public bool ConnectFoam; |
|
/// <summary> |
|
/// 连接的水源 |
|
/// </summary> |
|
public GameObject WaterSource; |
|
/// <summary> |
|
/// 连接的管线 |
|
/// </summary> |
|
public GameObject ConnectWaterHose; |
|
/// <summary> |
|
/// 连接的消防员 |
|
/// </summary> |
|
public GameObject ConnectFireman; |
|
public Vector3 EndPoint; |
|
|
|
// public Dictionary<int, float> lengthDic = new Dictionary<int, float>(); |
|
public void OnEnable() |
|
{ |
|
MessageDispatcher.AddListener("WATER_HOSE_DESTORY_COMMAND", DelectWaterSourceInfo); |
|
UsedHoseValue.getAllUsedHose += addMyHosedNumber; |
|
} |
|
|
|
|
|
public void OnDisable() |
|
{ |
|
MessageDispatcher.RemoveListener("WATER_HOSE_DESTORY_COMMAND", DelectWaterSourceInfo); |
|
UsedHoseValue.getAllUsedHose -= addMyHosedNumber; |
|
} |
|
|
|
public void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("WATER_HOSE_DESTORY_COMMAND", DelectWaterSourceInfo); |
|
UsedHoseValue.getAllUsedHose -= addMyHosedNumber; |
|
} |
|
|
|
/// <summary> |
|
/// 如果铺设的水带所连接的管线被删除 |
|
/// </summary> |
|
/// <param name="obj"></param> |
|
private void DelectWaterSourceInfo(IMessage obj) |
|
{ |
|
var data = (WaterHoseDelectCmdArgs)obj.Data; |
|
if (data.SelectHoseWater== ConnectWaterHose) |
|
{ |
|
ConnectWater = false; |
|
ConnectFoam = false; |
|
WaterSource = null; |
|
ConnectWaterHose = null; |
|
} |
|
} |
|
|
|
|
|
/// <summary> |
|
/// 水源信息绑定 |
|
/// </summary> |
|
/// <param name="water">是否有水</param> |
|
/// <param name="foam">是否有泡沫</param> |
|
/// <param name="source">连接的水源物体</param> |
|
/// <param name="connectwaterHose">连接的水带</param> |
|
public void BindWaterSource(bool water, bool foam, GameObject source, GameObject connectwaterHose) |
|
{ |
|
if (water) |
|
{ |
|
ConnectWater = true; |
|
} |
|
if (foam) |
|
{ |
|
ConnectFoam = true; |
|
} |
|
WaterSource = source; |
|
ConnectWaterHose = connectwaterHose; |
|
} |
|
private IntData addMyHosedNumber(IntData data) |
|
{ |
|
data.value += UseNum; |
|
return data; |
|
} |
|
}
|
|
|