贺州人民医院电子沙盘
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.
 
 
 
 

64 lines
1.6 KiB

using AX.MessageSystem;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 接受供水的设备,如水炮、暴风雪炮
/// </summary>
public class WaterReceiver : MonoBehaviour
{
/// <summary>
/// 是否连接水源
/// </summary>
public bool hasSupplier;
private Vector3 connectPos;
public Transform connectPoint;
public List<long> waterlinelist = new List<long>();
private void Start()
{
connectPoint = transform.Find("ConnectPoint");
if (connectPoint != null)
{
connectPos = connectPoint.position;
}
else
{
connectPos = transform.position;
}
MessageDispatcher.AddListener("WaterSourceChanged", WaterLineChanged);
}
private void OnDestroy()
{
MessageDispatcher.RemoveListener("WaterSourceChanged", WaterLineChanged);
}
private void WaterLineChanged(IMessage obj)
{
var data = (WaterConnectionData)obj.Data;
if (data.receiverID == GetComponent<BaseGameObjInfo>().gameObjID)
{
if(data.connected == false && GetComponent<ObjDrag>())
{
GetComponent<ObjDrag>().enabled = true;
}
}
}
public Vector3 ConnectPos
{
get
{
if (connectPoint != null)
{
connectPos = connectPoint.position;
}
else
{
connectPos = transform.position;
}
return connectPos;
}
}
}