网上演练
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.

55 lines
2.1 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using AX.Network.Protocols;
using UnityEngine;
using AX.Serialization;
//车辆 水源信息同步,要改成连接和删除管线的时候处理,将舍弃
public class TRUCK_WATER_MESSAGE_SYNC : NetworkMessageBehaviour
{
protected override void Execute(BinaryMessage message)
{
InputHistory.Instance.RegisterInputHistory(message);
var info = message.Body.Deserialize<TruckWaterMessageSyncData>();
var sender = info.SendUserID;
if (InputManager.Instance)
{
if (CurrentUserInfo.mySelf.Id != sender)
{
//TruckBindWaterSource bind = GetComponent<TruckBindWaterSource>();
if (GetComponent<BaseGameObjInfo>().gameObjID == info.gameObjID)
{
GetComponent<TruckBindWaterSource>().ConnectFoam = info.ConnectFoam;
GetComponent<TruckBindWaterSource>().ConnectWater = info.ConnectWater;
GameObject connecthose = EntitiesManager.Instance.GetEntityByID(info.ConnectWaterHose);
if (info.IsConncet)
{
if (!GetComponent<TruckBindWaterSource>().allConnectWaterHose.Contains(connecthose))
{
GetComponent<TruckBindWaterSource>().allConnectWaterHose.Add(connecthose);
}
GetComponent<AgentController>().pathFindEnable = false;
}
else
{
if (GetComponent<TruckBindWaterSource>().allConnectWaterHose.Contains(connecthose))
{
GetComponent<TruckBindWaterSource>().allConnectWaterHose.Remove(connecthose);
}
if (GetComponent<TruckBindWaterSource>().allConnectWaterHose.Count<=0)
{
GetComponent<AgentController>().pathFindEnable = true;
}
}
}
}
}
}
}