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.
657 lines
22 KiB
657 lines
22 KiB
using AX.MessageSystem; |
|
using AX.NetworkSystem; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using AX.Network.Protocols; |
|
using System; |
|
using AX.Serialization; |
|
using UnityEngine.UI; |
|
|
|
public enum SnowCannonSkill |
|
{ |
|
None, |
|
喷水, |
|
喷泡沫, |
|
} |
|
public class SonwWaterCannonSkillData |
|
{ |
|
public long SenderId; |
|
public long GameObjId; |
|
public SnowCannonSkill skill; |
|
} |
|
public class SnowConnonController : MonoBehaviour |
|
{ |
|
|
|
public List<List<long>> WaterSourceLine = new List<List<long>>();//进水口线路 |
|
|
|
public bool IsConnentWaterLine; |
|
public bool hasWaterConnect; |
|
public bool hasFoamConnect; |
|
public bool IsConnentWaterSource; |
|
public GameObject ConnentSource; |
|
public GameObject WaterLineConnent; |
|
|
|
public SnowCannonSkill skill = SnowCannonSkill.None; |
|
private Transform Hose; |
|
public GameObject FrothPrefabs; |
|
public GameObject WaterStraightPrefabs; |
|
/// <summary> |
|
/// 粒子大小 |
|
/// </summary> |
|
public float ParticleSize = 1; |
|
//暴风雪炮纵向旋转 |
|
public float VMinRotate = 0f; |
|
public float VMaxRotate = 20f; |
|
private Transform paotong; |
|
|
|
public SprayMode spraymode = SprayMode.PS30; |
|
public bool waterrunoutof; |
|
|
|
private bool IsSpray = false;//是否在出水/泡沫 |
|
/// <summary> |
|
/// 流量 |
|
/// </summary> |
|
public float flow; |
|
/// <summary> |
|
/// 剩余时间 |
|
/// </summary> |
|
public int RemainTime; |
|
/// <summary> |
|
/// 剩余水量 |
|
/// </summary> |
|
public float RemainWater; |
|
|
|
private float timer = 1f; |
|
private GameObject Waterstraight; |
|
private GameObject Froth; |
|
private BaseGameObjInfo basegameInfo; |
|
|
|
public float Flow |
|
{ |
|
get |
|
{ |
|
return flow; |
|
} |
|
|
|
set |
|
{ |
|
flow = value; |
|
//if (WaterLineConnent) |
|
//{//修改管线是否有水 |
|
// WaterLineConnent.GetComponent<ParentLinesMessage>().HasWaterCross = value > 0 ? true : false; |
|
//} |
|
if (WaterSourceLine.Count > 0) |
|
{//fenliu |
|
if (ConnentSource.GetComponent<TruckMessage>()) |
|
{//直接水源是车辆 |
|
float remain = CheckWaterRemain(WaterSourceLine); |
|
if (remain > 0 || remain == -100) |
|
{//水源有水 |
|
if (ConnentSource.GetComponent<TruckMessage>()) |
|
{//直接水源为水源车辆 |
|
|
|
ConnentSource.GetComponent<WaterSource>().TotalFlowChange(basegameInfo.gameObjID, flow); |
|
} |
|
} |
|
else |
|
{ |
|
Debug.Log("水源没水了"); |
|
} |
|
} |
|
else |
|
{//直接连接的消防设施 |
|
// GetComponent<FireManWaterHoseManager>().ConnentSource.GetComponent<WaterSource>().TotalFlow += (value - prveflow); |
|
ConnentSource.GetComponent<WaterSource>().TotalFlowChange(basegameInfo.gameObjID, flow); |
|
} |
|
} |
|
//流量同步 |
|
FlowChangeData arg = new FlowChangeData |
|
{ |
|
SenderId = CurrentUserInfo.mySelf.Id, |
|
GameObjId = GetComponent<BaseGameObjInfo>().gameObjID, |
|
Flow = value, |
|
}; |
|
NetworkManager.Default.SendAsync("FLOW_CHANGE_SYNC", arg); |
|
} |
|
} |
|
|
|
public SnowCannonSkill Skill |
|
{ |
|
get |
|
{ |
|
return skill; |
|
} |
|
|
|
set |
|
{ |
|
skill = value; |
|
//SonwWaterCannonSkillData arg = new SonwWaterCannonSkillData |
|
//{ |
|
// SenderId = CurrentUserInfo.mySelf.Id, |
|
// GameObjId = GetComponent<BaseGameObjInfo>().gameObjID, |
|
// skill = value |
|
//}; |
|
//NetworkManager.Default.SendAsync("MOVE_WATERCANNON_SKILL_SYNC", arg); |
|
} |
|
} |
|
|
|
// Use this for initialization |
|
void Start() |
|
{ |
|
paotong = transform.Find("XuePao_tong"); |
|
basegameInfo = GetComponent<BaseGameObjInfo>(); |
|
Hose = TransformHelper.FindChild(transform, "Hose"); |
|
|
|
//if (FrothPrefabs == null) |
|
//{ |
|
// FrothPrefabs = Resources.Load<GameObject>("Particle/Froth"); |
|
//} |
|
//if (WaterStraightPrefabs == null) |
|
// WaterStraightPrefabs = Resources.Load<GameObject>("Particle/WaterStraight"); |
|
Waterstraight = Hose.transform.Find("WaterStraight").gameObject; |
|
Froth = Hose.transform.Find("Froth").gameObject; |
|
|
|
|
|
MessageDispatcher.AddListener("SPRAY_WATER", Changeflow); |
|
MessageDispatcher.AddListener("RUN_OUR_OF_WATER", CloseSpray); |
|
MessageDispatcher.AddListener("HOSE_CONNECT_OR_DELECT", ConnectOrDelectControl); |
|
NetworkMessageDispatcher.AddListener("SNOWCANNON_ROTATE_SYNC", RotationSync); |
|
//MessageDispatcher.AddListener("RUN_OUR_OF_WATER", CloseSpray); |
|
//MessageDispatcher.AddListener("SPRAY_WATER", Changeflow); |
|
|
|
GetRealtimeConsume.getAllRealtimeConsume += addMyRealtimeConsume; //统计实时流量 |
|
} |
|
|
|
|
|
public void OnEnable() |
|
{ |
|
} |
|
|
|
public void OnDisable() |
|
{ |
|
MessageDispatcher.RemoveListener("SPRAY_WATER", Changeflow); |
|
MessageDispatcher.RemoveListener("RUN_OUR_OF_WATER", CloseSpray); |
|
MessageDispatcher.RemoveListener("HOSE_CONNECT_OR_DELECT", ConnectOrDelectControl); |
|
NetworkMessageDispatcher.RemoveListener("SNOWCANNON_ROTATE_SYNC", RotationSync); |
|
} |
|
|
|
public void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("SPRAY_WATER", Changeflow); |
|
MessageDispatcher.RemoveListener("RUN_OUR_OF_WATER", CloseSpray); |
|
MessageDispatcher.RemoveListener("HOSE_CONNECT_OR_DELECT", ConnectOrDelectControl); |
|
NetworkMessageDispatcher.RemoveListener("SNOWCANNON_ROTATE_SYNC", RotationSync); |
|
|
|
GetRealtimeConsume.getAllRealtimeConsume -= addMyRealtimeConsume; |
|
} |
|
|
|
private FloatData addMyRealtimeConsume(FloatData data) |
|
{ |
|
data.value += Flow; |
|
return data; |
|
} |
|
|
|
/// <summary> |
|
/// 雪炮旋转同步 |
|
/// </summary> |
|
/// <param name="obj"></param> |
|
private void RotationSync(BinaryMessage obj) |
|
{ |
|
var info = obj.Body.Deserialize<SprayRotateSyncData>(); |
|
if (info.SendUserID != CurrentUserInfo.mySelf.Id) |
|
{ |
|
if (info.gameObjID == basegameInfo.gameObjID) |
|
{ |
|
paotong.transform.localEulerAngles = info.VrotateVec; |
|
transform.localEulerAngles = info.HrotateVec; |
|
} |
|
} |
|
} |
|
//同步的管线连接到该水泡上或者连接在该水炮的管线同步删除时,可拖动控制 |
|
private void ConnectOrDelectControl(IMessage obj) |
|
{ |
|
HoseConnectOrDelectData data = (HoseConnectOrDelectData)obj.Data; |
|
if (data.StartId == basegameInfo.gameObjID || |
|
data.EndId == basegameInfo.gameObjID) |
|
{ |
|
//可挪动处理 |
|
if (data.Isconnect) |
|
{ |
|
GetComponent<ObjDrag>().enabled = false; |
|
} |
|
else |
|
{ |
|
GetComponent<ObjDrag>().enabled = true; |
|
} |
|
//水源信息处理 |
|
GameObject connectHose = EntitiesManager.Instance.GetEntityByID(data.HoseId); |
|
GameObject anther = connectHose.GetComponent<ParentLinesMessage>().GetAnotherGameObj(basegameInfo.gameObjID); |
|
|
|
if (data.Isconnect) |
|
{ |
|
if (anther.GetComponent<WaterSource>()) |
|
{//另一端是水源 |
|
IsConnentWaterSource = true; |
|
ConnentSource = anther; |
|
hasWaterConnect = anther.GetComponent<WaterSource>().water; |
|
hasFoamConnect = anther.GetComponent<WaterSource>().foam; |
|
IsConnentWaterLine = true; |
|
WaterLineConnent = connectHose; |
|
ChangeWaterSourceLineInfo(data.StartId, 0); |
|
////如果连接了一个没有水的水源 |
|
//if (anther.GetComponent<WaterSource>().hasover) |
|
//{ |
|
// waterrunoutof = true; |
|
//} |
|
if (SnowConnonSkillPanelController.Instance) |
|
{ |
|
if (SnowConnonSkillPanelController.Instance.SelectSnowConnon == gameObject) |
|
{ |
|
SnowConnonSkillPanelController.Instance.SprayFoam.GetComponent<Toggle>().interactable = hasFoamConnect; |
|
SnowConnonSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = hasWaterConnect; |
|
} |
|
} |
|
} |
|
//if (anther.GetComponent<TruckBindWaterSource>() && !anther.GetComponent<WaterSource>()) |
|
//{//另一端是非水源出水车辆 |
|
// ConnentSource = anther.GetComponent<TruckBindWaterSource>().ConnentWaterSource; |
|
// if (ConnentSource != null) |
|
// { |
|
// IsConnentWaterSource = true; |
|
// hasWaterConnect = anther.GetComponent<TruckBindWaterSource>().ConnectWater; |
|
// hasFoamConnect = anther.GetComponent<TruckBindWaterSource>().ConnectFoam; |
|
// } |
|
|
|
//} |
|
} |
|
else |
|
{ |
|
Resert(); |
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
if (ConnentSource != null) |
|
{ |
|
// if (waterrunoutof == false) |
|
{ |
|
if (Flow > 0) |
|
{ |
|
timer -= Time.deltaTime; |
|
if (timer <= 0) |
|
{ |
|
var watertimepair = GetWaterAndTimeRemain(WaterSourceLine); |
|
RemainTime = watertimepair.Key; |
|
RemainWater = watertimepair.Value; |
|
if (watertimepair.Key != -100) |
|
{ |
|
if (watertimepair.Key <= 0 || watertimepair.Value <= 0) |
|
{//没水了 |
|
stopSpray(); |
|
} |
|
} |
|
if (Skill == SnowCannonSkill.喷泡沫) |
|
{ |
|
float remainfoam = CheckFoamRemain(); |
|
if (remainfoam == -100 || remainfoam > 0) |
|
{ |
|
ConnentSource.GetComponent<WaterSource>().UserFoam((Flow / 0.97f) * 0.03f); |
|
} |
|
else |
|
{ |
|
// LoadPromptWin.Instance.LoadTextPromptWindow("泡沫量不足", 1f); |
|
stopSpray(); |
|
} |
|
} |
|
timer = 1f; |
|
} |
|
} |
|
} |
|
} |
|
|
|
} |
|
|
|
private void Changeflow(IMessage obj) |
|
{ |
|
var info = (flowchangeinfo)obj.Data; |
|
if (info.ChangObjId == basegameInfo.gameObjID) |
|
{ |
|
if (ConnentSource != null) |
|
{ |
|
ConnentSource.GetComponent<WaterSource>().SetTotalFlow(new KeyValuePair<GameObject, float>(gameObject, Flow), info.IsAdd); |
|
} |
|
} |
|
IsSpray = info.IsAdd; |
|
} |
|
/// <summary> |
|
/// 连接的水源没有水了 |
|
/// </summary> |
|
/// <param name="obj"></param> |
|
private void CloseSpray(IMessage obj) |
|
{ |
|
if (skill == SnowCannonSkill.喷水 || skill == SnowCannonSkill.喷泡沫) |
|
{ |
|
long watersourceId = (long)obj.Data; |
|
long thiswaterid = ConnentSource.GetComponent<BaseGameObjInfo>().gameObjID; |
|
// Debug.Log(thiswaterid); |
|
if (watersourceId == thiswaterid) |
|
{ |
|
waterrunoutof = true; |
|
Flow = 0; |
|
skill = SnowCannonSkill.None; |
|
//if (MoveWaterConnonSkillPanelController.Instance) |
|
//{ |
|
// if (MoveWaterConnonSkillPanelController.Instance.selectMoveWaterConnon == gameObject) |
|
// { |
|
// MoveWaterConnonSkillPanelController.Instance.SprayFoam.GetComponent<Toggle>().isOn = false; |
|
// MoveWaterConnonSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn = false; |
|
// } |
|
//} |
|
|
|
Waterstraight.SetActive(false); |
|
Froth.SetActive(false); |
|
SpraySyncData spraysync = new SpraySyncData(); |
|
spraysync.SendUserID = CurrentUserInfo.mySelf.Id; |
|
spraysync.IsOn = false; |
|
spraysync.gameObjID = basegameInfo.gameObjID; |
|
NetworkManager.Default.SendAsync(/*CurrentUserInfo.mySelf.Id,*/ "SPRAY_WATER_SYNC", spraysync); |
|
} |
|
} |
|
|
|
} |
|
|
|
public void Spray(SnowCannonSkill type) |
|
{ |
|
if (type == SnowCannonSkill.喷水) |
|
{ |
|
Waterstraight.SetActive(true); |
|
Froth.SetActive(false); |
|
Waterstraight.GetComponentInChildren<ParticleControlOfType>().SetScaleValue(0.75f); |
|
ParticleSize = 0.75f; |
|
} |
|
if (type == SnowCannonSkill.喷泡沫) |
|
{ |
|
Waterstraight.SetActive(false); |
|
Froth.SetActive(true); |
|
Froth.GetComponentInChildren<ParticleControlOfType>().SetScaleValue(1.1f); |
|
ParticleSize = 1.1f; |
|
} |
|
if (type == SnowCannonSkill.None) |
|
{ |
|
for (int i = 0; i < Hose.childCount; i++) |
|
{ |
|
Hose.GetChild(i).gameObject.SetActive(false); |
|
} |
|
} |
|
} |
|
|
|
public void Up() |
|
{ |
|
float v = paotong.transform.localEulerAngles.x; |
|
|
|
if ((v > 280 && v < 360) || (v < 25)) |
|
{ |
|
paotong.transform.Rotate(5, 0, 0); |
|
} |
|
// Debug.Log(v); |
|
RotateSync(); |
|
} |
|
public void Down() |
|
{ |
|
float v = paotong.transform.localEulerAngles.x; |
|
|
|
if ((v > 275 && v < 360) || (v < 20)) |
|
{ |
|
paotong.transform.Rotate(-5, 0, 0); |
|
} |
|
RotateSync(); |
|
} |
|
|
|
public void Left() |
|
{ |
|
transform.Rotate(0, -10, 0); |
|
RotateSync(); |
|
} |
|
|
|
public void Right() |
|
{ |
|
transform.Rotate(0, 10, 0); |
|
RotateSync(); |
|
} |
|
void RotateSync() |
|
{ |
|
SprayRotateSyncData arg = new SprayRotateSyncData(); |
|
arg.SendUserID = CurrentUserInfo.mySelf.Id; |
|
arg.gameObjID = basegameInfo.gameObjID; |
|
arg.VrotateVec = paotong.transform.localEulerAngles; |
|
arg.HrotateVec = transform.localEulerAngles; |
|
NetworkManager.Default.SendAsync("SNOWCANNON_ROTATE_SYNC", arg); |
|
} |
|
public void Resert() |
|
{ |
|
IsConnentWaterLine = false; |
|
WaterLineConnent = null; |
|
IsConnentWaterSource = false; |
|
ConnentSource = null; |
|
hasFoamConnect = false; |
|
hasWaterConnect = false; |
|
WaterSourceLine = new List<List<long>>(); |
|
if (SnowConnonSkillPanelController.Instance) |
|
{ |
|
if (SnowConnonSkillPanelController.Instance.SelectSnowConnon == gameObject) |
|
{ |
|
SnowConnonSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn = false; |
|
SnowConnonSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = false; |
|
SnowConnonSkillPanelController.Instance.SprayFoam.GetComponent<Toggle>().isOn = false; |
|
SnowConnonSkillPanelController.Instance.SprayFoam.GetComponent<Toggle>().interactable = false; |
|
} |
|
|
|
} |
|
if (Hose.GetComponentInChildren<ParticleControlOfType>()) |
|
{ |
|
for (int i = 0; i < Hose.childCount; i++) |
|
{ |
|
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); |
|
} |
|
} |
|
|
|
/// <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) |
|
{ |
|
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 = 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() |
|
{ |
|
|
|
|
|
Spray(SnowCannonSkill.None); |
|
Skill = SnowCannonSkill.None; |
|
Flow = 0; |
|
RemainTime = 0; |
|
RemainWater = 0; |
|
if (SnowConnonSkillPanelController.Instance && SnowConnonSkillPanelController.Instance.SelectSnowConnon == gameObject) |
|
{ |
|
if (SnowConnonSkillPanelController.Instance.SprayFoam.GetComponent<Toggle>().isOn) |
|
{ |
|
SnowConnonSkillPanelController.Instance.SprayFoam.GetComponent<Toggle>().isOn = false; |
|
} |
|
if (SnowConnonSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn) |
|
{ |
|
SnowConnonSkillPanelController.Instance.SprayWater.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 = ConnentSource.GetComponent<WaterSource>(); |
|
if (ws.foam) |
|
{ |
|
if (ws.TotalFoam != -100) |
|
{ |
|
remain = ws.TotalFoam - ws.AllUserFoam; |
|
} |
|
else |
|
{ |
|
remain = -100; |
|
} |
|
} |
|
return remain; |
|
} |
|
}
|
|
|