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.
587 lines
19 KiB
587 lines
19 KiB
4 years ago
|
using AX.MessageSystem;
|
||
|
using AX.NetworkSystem;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.Network.Protocols;
|
||
|
using System;
|
||
|
using AX.Serialization;
|
||
|
|
||
|
public enum FireRobotSkill
|
||
|
{
|
||
|
待命,
|
||
|
出水,
|
||
|
出泡沫,
|
||
|
铺设水带,
|
||
|
收起水带,
|
||
|
装备选择,
|
||
|
背包
|
||
|
}
|
||
|
public class FireRobotSkillData
|
||
|
{
|
||
|
public long SenderId;
|
||
|
public long GameObjId;
|
||
|
public FireRobotSkill WorkType;
|
||
|
}
|
||
|
public class FireRobotController : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
//旋转
|
||
|
public Transform HRotate;
|
||
|
public Transform VRotate;
|
||
|
private float V;
|
||
|
public float MaxVrotate = 39f;
|
||
|
public float MinVrotate = -39f;
|
||
|
//技能同步
|
||
|
public FireRobotSkill workType;
|
||
|
public FireRobotSkill WorkType
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return workType;
|
||
|
}
|
||
|
|
||
|
set
|
||
|
{
|
||
|
workType = value;
|
||
|
//机器人技能同步
|
||
|
//FireRobotSkillData worksync = new FireRobotSkillData();
|
||
|
//worksync.SenderId = CurrentUserInfo.mySelf.Id;
|
||
|
//worksync.WorkType = value;
|
||
|
//worksync.GameObjId = basegameinfo.gameObjID;
|
||
|
//NetworkManager.Default.SendAsync( "FIREROBOT_WORKTYPECHANGE_SYNC", worksync);
|
||
|
}
|
||
|
}
|
||
|
//流量
|
||
|
public float flow;
|
||
|
public float Flow
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return flow;
|
||
|
}
|
||
|
|
||
|
set
|
||
|
{
|
||
|
flow = value;
|
||
|
|
||
|
//if (GetComponent<FireRobotWaterHoseManage>().WaterLineConnent)
|
||
|
//{
|
||
|
// GetComponent<FireRobotWaterHoseManage>().WaterLineConnent.GetComponent<ParentLinesMessage>().HasWaterCross = value > 0 ? true : false;
|
||
|
//}
|
||
|
//流量修改时重新分流
|
||
|
if (GetComponent<FireRobotWaterHoseManage>())
|
||
|
{
|
||
|
if (GetComponent<FireRobotWaterHoseManage>().ConnentSource)
|
||
|
{
|
||
|
if (GetComponent<FireRobotWaterHoseManage>().ConnentSource.GetComponent<TruckMessage>())
|
||
|
{//直接水源是车辆
|
||
|
float remain = CheckWaterRemain(GetComponent<FireRobotWaterHoseManage>().WaterSourceLine);
|
||
|
if (remain > 0 || remain == -100)
|
||
|
{//水源有水
|
||
|
if (GetComponent<FireRobotWaterHoseManage>().ConnentSource.GetComponent<TruckMessage>())
|
||
|
{//直接水源为水源车辆
|
||
|
// GetComponent<FireManWaterHoseManager>().ConnentSource.GetComponent<TruckBindWaterSource>().Flow += ;
|
||
|
GetComponent<FireRobotWaterHoseManage>().ConnentSource.GetComponent<WaterSource>().TotalFlowChange(basegameinfo.gameObjID, flow);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Debug.Log("水源没水了");
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{//直接连接的消防设施
|
||
|
// GetComponent<FireManWaterHoseManager>().ConnentSource.GetComponent<WaterSource>().TotalFlow += (value - prveflow);
|
||
|
GetComponent<FireRobotWaterHoseManage>().ConnentSource.GetComponent<WaterSource>().TotalFlowChange(basegameinfo.gameObjID, flow);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//流量同步
|
||
|
FlowChangeData arg = new FlowChangeData
|
||
|
{
|
||
|
SenderId = CurrentUserInfo.mySelf.Id,
|
||
|
GameObjId = basegameinfo.gameObjID,
|
||
|
Flow = value,
|
||
|
};
|
||
|
NetworkManager.Default.SendAsync("FLOW_CHANGE_SYNC", arg);
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 剩余时间
|
||
|
/// </summary>
|
||
|
public int RemainTime;
|
||
|
/// <summary>
|
||
|
/// 剩余水量
|
||
|
/// </summary>
|
||
|
public float RemainWater;
|
||
|
public SprayMode spraymode = SprayMode.WaterGun19;
|
||
|
/// <summary>
|
||
|
/// 水量用完
|
||
|
/// </summary>
|
||
|
public bool waterrunoutof = false;
|
||
|
private BaseGameObjInfo basegameinfo;
|
||
|
public SprayParticleType SelectParticleType;
|
||
|
//粒子大小
|
||
|
public float ParticleSize = 0.2f;
|
||
|
|
||
|
public float MaxSize = 0.4f;
|
||
|
public float MinSize = 0.0f;
|
||
|
//出水粒子
|
||
|
private Transform Hose;
|
||
|
private Transform frothpart;
|
||
|
private Transform straightpart;
|
||
|
private FireRobotWaterHoseManage hosemanage;
|
||
|
//计时器
|
||
|
private float timer;
|
||
|
void Start()
|
||
|
{
|
||
|
basegameinfo = GetComponent<BaseGameObjInfo>();
|
||
|
hosemanage = GetComponent<FireRobotWaterHoseManage>();
|
||
|
Hose = transform.Find("Pao1/Pao2/Hose");
|
||
|
frothpart = Hose.Find("Froth");
|
||
|
straightpart = Hose.Find("WaterStraight");
|
||
|
MessageDispatcher.AddListener("SPRAY_WATER", Changeflow);
|
||
|
MessageDispatcher.AddListener("RUN_OUR_OF_WATER", CloseSpray);
|
||
|
NetworkMessageDispatcher.AddListener("FIREROBOT_ROTATE_SYNC", RotationSync);
|
||
|
|
||
|
GetRealtimeConsume.getAllRealtimeConsume += addMyRealtimeConsume; //统计实时流量
|
||
|
}
|
||
|
void OnDisable()
|
||
|
{
|
||
|
|
||
|
MessageDispatcher.RemoveListener("SPRAY_WATER", Changeflow);
|
||
|
MessageDispatcher.RemoveListener("RUN_OUR_OF_WATER", CloseSpray);
|
||
|
NetworkMessageDispatcher.AddListener("FIREROBOT_ROTATE_SYNC", RotationSync);
|
||
|
}
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
|
||
|
MessageDispatcher.RemoveListener("SPRAY_WATER", Changeflow);
|
||
|
MessageDispatcher.RemoveListener("RUN_OUR_OF_WATER", CloseSpray);
|
||
|
NetworkMessageDispatcher.AddListener("FIREROBOT_ROTATE_SYNC", RotationSync);
|
||
|
|
||
|
GetRealtimeConsume.getAllRealtimeConsume -= addMyRealtimeConsume;
|
||
|
}
|
||
|
|
||
|
private FloatData addMyRealtimeConsume(FloatData data)
|
||
|
{
|
||
|
data.value += Flow;
|
||
|
return data;
|
||
|
}
|
||
|
|
||
|
void Update()
|
||
|
{
|
||
|
if (Flow > 0)
|
||
|
{
|
||
|
timer -= Time.deltaTime;
|
||
|
if (timer <= 0)
|
||
|
{
|
||
|
var watertimepair = GetWaterAndTimeRemain(hosemanage.WaterSourceLine);
|
||
|
RemainTime = watertimepair.Key;
|
||
|
RemainWater = watertimepair.Value;
|
||
|
if (watertimepair.Key != -100)
|
||
|
{
|
||
|
if (watertimepair.Key <= 0 || watertimepair.Value <= 0)
|
||
|
{//没水了
|
||
|
stopSpray();
|
||
|
}
|
||
|
}
|
||
|
if (WorkType == FireRobotSkill.出泡沫)
|
||
|
{
|
||
|
float remainfoam = CheckFoamRemain();
|
||
|
if (remainfoam == -100 || remainfoam > 0)
|
||
|
{
|
||
|
GetComponent<FireRobotWaterHoseManage>().ConnentSource.GetComponent<WaterSource>().UserFoam((Flow / 0.97f) * 0.03f);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
stopSpray();
|
||
|
}
|
||
|
}
|
||
|
timer = 1f;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void Changeflow(IMessage obj)
|
||
|
{
|
||
|
var info = (flowchangeinfo)obj.Data;
|
||
|
if (info.ChangObjId == basegameinfo.gameObjID)
|
||
|
{
|
||
|
GameObject watersource = GetComponent<FireRobotWaterHoseManage>().ConnentSource;
|
||
|
if (watersource != null)
|
||
|
{
|
||
|
watersource.GetComponent<WaterSource>().SetTotalFlow(new KeyValuePair<GameObject, float>(gameObject, Flow), info.IsAdd);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 连接的水源没有水了
|
||
|
/// </summary>
|
||
|
/// <param name="obj"></param>
|
||
|
private void CloseSpray(IMessage obj)
|
||
|
{
|
||
|
// Debug.Log("over22");
|
||
|
if (WorkType == FireRobotSkill.出水 || WorkType == FireRobotSkill.出泡沫)
|
||
|
{
|
||
|
long watersourceId = (long)obj.Data;
|
||
|
long thiswaterid = -1;
|
||
|
if (GetComponent<FireRobotWaterHoseManage>().ConnentSource != null)
|
||
|
{
|
||
|
thiswaterid = GetComponent<FireRobotWaterHoseManage>().ConnentSource.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
}
|
||
|
// Debug.Log(thiswaterid);
|
||
|
if (watersourceId == thiswaterid)
|
||
|
{
|
||
|
waterrunoutof = true;
|
||
|
WorkType = FireRobotSkill.待命;
|
||
|
Flow = 0;
|
||
|
if (FireRobotSkillPanelController.Instance)
|
||
|
{
|
||
|
if (FireRobotSkillPanelController.Instance.SelectRobot == gameObject)
|
||
|
{
|
||
|
FireRobotSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn = false;
|
||
|
FireRobotSkillPanelController.Instance.SprayFroth.GetComponent<Toggle>().isOn = false;
|
||
|
}
|
||
|
}
|
||
|
DestoryPartical();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 机器人出水/泡沫
|
||
|
/// </summary>
|
||
|
/// <param name="type"></param>
|
||
|
public void SetParticleType(SprayParticleType type)
|
||
|
{
|
||
|
if (type == SprayParticleType.Froth)
|
||
|
{
|
||
|
if (straightpart.gameObject.activeInHierarchy)
|
||
|
{
|
||
|
straightpart.gameObject.SetActive(false);
|
||
|
}
|
||
|
frothpart.gameObject.SetActive(true);
|
||
|
frothpart.GetComponentInChildren<ParticleControlOfType>().SetScaleValue(0.95f);
|
||
|
ParticleSize = 0.95f;
|
||
|
}
|
||
|
if (type == SprayParticleType.WaterStraight)
|
||
|
{
|
||
|
if (frothpart.gameObject.activeInHierarchy)
|
||
|
{
|
||
|
frothpart.gameObject.SetActive(false);
|
||
|
}
|
||
|
straightpart.gameObject.SetActive(true);
|
||
|
straightpart.GetComponentInChildren<ParticleControlOfType>().SetScaleValue(0.2f);
|
||
|
ParticleSize = 0.2f;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 停止出水、出泡沫并同步
|
||
|
/// </summary>
|
||
|
public void DestoryPartical()
|
||
|
{
|
||
|
for (int i = 0; i < Hose.childCount; i++)
|
||
|
{
|
||
|
if (Hose.GetChild(i).gameObject.activeInHierarchy)
|
||
|
{
|
||
|
Hose.GetChild(i).gameObject.SetActive(false);
|
||
|
}
|
||
|
}
|
||
|
SpraySyncData spraysync = new SpraySyncData();
|
||
|
spraysync.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
spraysync.IsOn = false;
|
||
|
spraysync.gameObjID = basegameinfo.gameObjID;
|
||
|
NetworkManager.Default.SendAsync("SPRAY_WATER_SYNC", spraysync);
|
||
|
}
|
||
|
public void Up()
|
||
|
{
|
||
|
float V = VRotate.localRotation.eulerAngles.y;
|
||
|
if (checkV(V) > MinVrotate)
|
||
|
{
|
||
|
V -= 5f;
|
||
|
VRotate.localRotation =
|
||
|
Quaternion.Euler(VRotate.localRotation.eulerAngles.x, V, VRotate.localRotation.eulerAngles.z);
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
V = MinVrotate;
|
||
|
VRotate.localRotation =
|
||
|
Quaternion.Euler(VRotate.localRotation.eulerAngles.x, V, VRotate.localRotation.eulerAngles.z);
|
||
|
|
||
|
}
|
||
|
RotationSync();
|
||
|
}
|
||
|
public void Down()
|
||
|
{
|
||
|
float V = VRotate.localRotation.eulerAngles.y;
|
||
|
if (checkV(V) < MaxVrotate)
|
||
|
{
|
||
|
V += 5f;
|
||
|
VRotate.localRotation =
|
||
|
Quaternion.Euler(VRotate.localRotation.eulerAngles.x, V, VRotate.localRotation.eulerAngles.z);
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
V = MaxVrotate;
|
||
|
VRotate.localRotation =
|
||
|
Quaternion.Euler(VRotate.localRotation.eulerAngles.x, V, VRotate.localRotation.eulerAngles.z);
|
||
|
|
||
|
}
|
||
|
RotationSync();
|
||
|
}
|
||
|
public void Left()
|
||
|
{
|
||
|
float H = HRotate.localRotation.eulerAngles.y;
|
||
|
H -= 10f;
|
||
|
HRotate.localRotation =
|
||
|
Quaternion.Euler(HRotate.localRotation.eulerAngles.x, H, HRotate.localRotation.eulerAngles.z);
|
||
|
RotationSync();
|
||
|
}
|
||
|
|
||
|
public void Right()
|
||
|
{
|
||
|
float H = HRotate.localRotation.eulerAngles.y;
|
||
|
H += 10f;
|
||
|
HRotate.localRotation =
|
||
|
Quaternion.Euler(HRotate.localRotation.eulerAngles.x, H, HRotate.localRotation.eulerAngles.z);
|
||
|
RotationSync();
|
||
|
}
|
||
|
|
||
|
void RotationSync()
|
||
|
{
|
||
|
SprayRotateSyncData arg = new SprayRotateSyncData();
|
||
|
arg.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
arg.gameObjID = basegameinfo.gameObjID;
|
||
|
arg.Vroatet = VRotate.localEulerAngles.y;
|
||
|
arg.Hrotate = HRotate.localEulerAngles.y;
|
||
|
NetworkManager.Default.SendAsync("FIREROBOT_ROTATE_SYNC", arg);
|
||
|
}
|
||
|
void RotateSync()
|
||
|
{
|
||
|
SprayRotateSyncData arg = new SprayRotateSyncData();
|
||
|
arg.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
arg.gameObjID = basegameinfo.gameObjID;
|
||
|
arg.Vroatet = VRotate.localRotation.eulerAngles.y;
|
||
|
arg.Hrotate = HRotate.localRotation.eulerAngles.y;
|
||
|
NetworkManager.Default.SendAsync("FIREROBOT_ROTATE_SYNC", arg);
|
||
|
}
|
||
|
private void RotationSync(BinaryMessage obj)
|
||
|
{
|
||
|
var info = obj.Body.Deserialize<SprayRotateSyncData>();
|
||
|
if (info.SendUserID != CurrentUserInfo.mySelf.Id)
|
||
|
{
|
||
|
if (info.gameObjID == basegameinfo.gameObjID)
|
||
|
{
|
||
|
VRotate.localEulerAngles = new Vector3(VRotate.transform.localEulerAngles.x, info.Vroatet, VRotate.localEulerAngles.z);
|
||
|
HRotate.localEulerAngles = new Vector3(HRotate.transform.localEulerAngles.x, info.Hrotate, HRotate.transform.localEulerAngles.z);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
float checkV(float value)
|
||
|
{
|
||
|
if (value > 180)
|
||
|
{
|
||
|
return value -= 360;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return value;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 连接水源时造成的水源信息修改
|
||
|
/// </summary>
|
||
|
/// <param name="watersourcevalue">直接水源上的两条线路信息总和</param>
|
||
|
/// <param name="directionId">直接水源id</param>
|
||
|
/// <param name="linenum">连接的哪条线路</param>
|
||
|
public void ChangeWaterSourceLineInfo(long directionId, int linenum)
|
||
|
{
|
||
|
List<List<long>> go = CloneBySerialize.Clone(GetDirectWaterSourceInfo(directionId));
|
||
|
go.Insert(0, new List<long> { directionId });
|
||
|
if (linenum == 0)
|
||
|
{
|
||
|
hosemanage.WaterSourceLine = go;
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 获取直接水源上的所有水源信息
|
||
|
/// </summary>
|
||
|
/// <param name="directtionId">直接水源ID</param>
|
||
|
/// <returns></returns>
|
||
|
public List<List<long>> GetDirectWaterSourceInfo(long directtionId)
|
||
|
{
|
||
|
List<List<long>> go = new List<List<long>>();
|
||
|
GameObject dirobj = EntitiesManager.Instance.GetEntityByID(directtionId);
|
||
|
if (dirobj.GetComponent<TruckBindWaterSource>())
|
||
|
{
|
||
|
TruckBindWaterSource dirTBC = dirobj.GetComponent<TruckBindWaterSource>();
|
||
|
List<List<long>> line1 = CloneBySerialize.Clone(dirTBC.WaterSourceLine1);
|
||
|
List<List<long>> line2 = CloneBySerialize.Clone(dirTBC.WaterSourceLine2);
|
||
|
line1.Reverse();
|
||
|
line2.Reverse();
|
||
|
int count = line1.Count >= line2.Count ? line1.Count : line2.Count;
|
||
|
//List<List<long>> go = new List<List<long>>(count);
|
||
|
for (int i = 0; i < count; i++)
|
||
|
{
|
||
|
List<long> depth = new List<long>();
|
||
|
if (i < line1.Count)
|
||
|
{
|
||
|
for (int j = 0; j < line1[i].Count; j++)
|
||
|
{
|
||
|
depth.Add(line1[i][j]);
|
||
|
}
|
||
|
}
|
||
|
if (i < line2.Count)
|
||
|
{
|
||
|
for (int j = 0; j < line2[i].Count; j++)
|
||
|
{
|
||
|
depth.Add(line2[i][j]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
go.Add(depth);
|
||
|
}
|
||
|
go.Reverse();
|
||
|
}
|
||
|
else
|
||
|
{//消防设施没有进水口
|
||
|
|
||
|
}
|
||
|
|
||
|
return go;
|
||
|
}
|
||
|
|
||
|
public float CheckWaterRemain(List<List<long>> watersouce)
|
||
|
{
|
||
|
float allremain = 0;
|
||
|
|
||
|
for (int i = 0; i < watersouce.Count; i++)
|
||
|
{
|
||
|
for (int j = 0; j < watersouce[i].Count; j++)
|
||
|
{
|
||
|
WaterSource ws = EntitiesManager.Instance.GetEntityByID(watersouce[i][j]).GetComponent<WaterSource>();
|
||
|
if (ws.TotalWater != -100)
|
||
|
{
|
||
|
allremain += (ws.TotalWater - ws.AllUserWater);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
allremain = -100;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return allremain;
|
||
|
}
|
||
|
|
||
|
public KeyValuePair<int, float> GetWaterAndTimeRemain(List<List<long>> waterline)
|
||
|
{
|
||
|
KeyValuePair<int, float> remain = new KeyValuePair<int, float>();
|
||
|
//float allflow = 0;
|
||
|
float remainwater = 0;
|
||
|
List<long> allwatersource = new List<long>();
|
||
|
for (int i = 0; i < waterline.Count; i++)
|
||
|
{
|
||
|
for (int j = 0; j < waterline[i].Count; j++)
|
||
|
{
|
||
|
if (!allwatersource.Contains(waterline[i][j]))
|
||
|
{
|
||
|
allwatersource.Add(waterline[i][j]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
for (int i = 0; i < allwatersource.Count; i++)
|
||
|
{
|
||
|
WaterSource ws = EntitiesManager.Instance.GetEntityByID(allwatersource[i]).GetComponent<WaterSource>();
|
||
|
if (ws.TotalWater != -100)
|
||
|
{
|
||
|
remainwater += (ws.TotalWater - ws.AllUserWater);
|
||
|
//if (ws.GetComponent<TruckBindWaterSource>())
|
||
|
//{
|
||
|
// allflow += ws.GetComponent<TruckBindWaterSource>().Flow;
|
||
|
//}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
remainwater = -100;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
int remaintime = 0;
|
||
|
//allflow += Flow;
|
||
|
if (remainwater == -100)
|
||
|
{
|
||
|
remaintime = -100;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
float realewater = 0;//实际分到的水量=自己的流量/直接水源的总流量*直接水源总流量
|
||
|
float dirTotalFlow = GetComponent<FireRobotWaterHoseManage>().ConnentSource.GetComponent<WaterSource>().TotalFlow;
|
||
|
realewater = (Flow / dirTotalFlow) * remainwater;
|
||
|
if (Flow != 0)
|
||
|
remaintime = Mathf.CeilToInt(realewater / Flow);
|
||
|
else
|
||
|
remaintime = 0;
|
||
|
}
|
||
|
remain = new KeyValuePair<int, float>(remaintime, remainwater);
|
||
|
|
||
|
|
||
|
return remain;
|
||
|
}
|
||
|
void stopSpray()
|
||
|
{
|
||
|
Flow = 0;
|
||
|
WorkType = FireRobotSkill.待命;
|
||
|
RemainTime = 0;
|
||
|
RemainWater = 0;
|
||
|
for (int i = 0; i < Hose.childCount; i++)
|
||
|
{
|
||
|
if (Hose.GetChild(i).gameObject.activeInHierarchy)
|
||
|
{
|
||
|
Hose.GetChild(i).gameObject.SetActive(false);
|
||
|
}
|
||
|
}
|
||
|
if (FireRobotSkillPanelController.Instance && FireRobotSkillPanelController.Instance.SelectRobot == gameObject)
|
||
|
{
|
||
|
FireRobotSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn = false;
|
||
|
FireRobotSkillPanelController.Instance.SprayFroth.GetComponent<Toggle>().isOn = false;
|
||
|
}
|
||
|
SpraySyncData spraysync = new SpraySyncData();
|
||
|
spraysync.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
spraysync.spraytype = SprayParticleType.WaterStraight;
|
||
|
spraysync.IsOn = false;
|
||
|
spraysync.gameObjID = basegameinfo.gameObjID;
|
||
|
NetworkManager.Default.SendAsync("SPRAY_WATER_SYNC", spraysync);
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public float CheckFoamRemain()
|
||
|
{
|
||
|
float remain = 0;
|
||
|
WaterSource ws = GetComponent<FireRobotWaterHoseManage>().ConnentSource.GetComponent<WaterSource>();
|
||
|
if (ws.foam)
|
||
|
{
|
||
|
if (ws.TotalFoam != -100)
|
||
|
{
|
||
|
remain = ws.TotalFoam - ws.AllUserFoam;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
remain = -100;
|
||
|
}
|
||
|
}
|
||
|
return remain;
|
||
|
}
|
||
|
}
|