|
|
|
@ -60,10 +60,10 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 如果是本客户端 |
|
|
|
|
/// </summary> |
|
|
|
|
public bool IsselfCurrent=true; |
|
|
|
|
public bool IsselfCurrent = true; |
|
|
|
|
private int creatnum = 1; |
|
|
|
|
// private bool setInitpoint; |
|
|
|
|
// public float LastLenght; |
|
|
|
|
// private bool setInitpoint; |
|
|
|
|
// public float LastLenght; |
|
|
|
|
//private float LastLayLenght; |
|
|
|
|
// Use this for initialization |
|
|
|
|
void Start() |
|
|
|
@ -323,7 +323,7 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 开始铺设水带 |
|
|
|
|
/// </summary> |
|
|
|
|
public void StartLay() |
|
|
|
|
public void StartLay(bool issync = false) |
|
|
|
|
{ |
|
|
|
|
agent.SetDestination(transform.position); |
|
|
|
|
//if (GetComponent<FireManWaterHoseManager>().OverLenght > 0) |
|
|
|
@ -349,7 +349,7 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
} |
|
|
|
|
//ParentLayHose = EntitiesManager.Instance.CreateObj(ParentLayHosePrefabs, Vector3.zero, |
|
|
|
|
// WaterHoses.transform, EntitiesManager.Instance.CreateObjID(CurrentUserInfo.mySelf.Id)); // Instantiate(ParentLayHosePrefabs, WaterHoses.transform); |
|
|
|
|
ParentLayHose=Instantiate(ParentLayHosePrefabs, WaterHoses.transform); |
|
|
|
|
ParentLayHose = Instantiate(ParentLayHosePrefabs, WaterHoses.transform); |
|
|
|
|
//ParentLayHose.GetComponent<BaseGameObjInfo>().gameObjID = EntitiesManager.Instance.CreateObjID(CurrentUserInfo.mySelf.Id); |
|
|
|
|
ParentLayHose.name = "LayWaterHose" + creatnum; |
|
|
|
|
creatnum++; |
|
|
|
@ -377,18 +377,25 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
//更新消防员水源信息 |
|
|
|
|
if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null) |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo |
|
|
|
|
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose); |
|
|
|
|
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance) |
|
|
|
|
if (issync == false) |
|
|
|
|
{ |
|
|
|
|
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo |
|
|
|
|
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose); |
|
|
|
|
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance) |
|
|
|
|
{ |
|
|
|
|
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo(false, false, false, null, null); |
|
|
|
|
if (issync == false) |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo(false, false, false, null, null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
flag = true; |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFireman = gameObject; |
|
|
|
@ -441,7 +448,7 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 消防员喷水、泡沫时铺设水带 |
|
|
|
|
/// </summary> |
|
|
|
|
public void StartSprayingLay() |
|
|
|
|
public void StartSprayingLay(bool issync = false) |
|
|
|
|
{ |
|
|
|
|
agent.SetDestination(transform.position); |
|
|
|
|
if (!GetComponent<AgentController>().pathFindEnable) |
|
|
|
@ -459,10 +466,14 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
{ |
|
|
|
|
if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null) |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo |
|
|
|
|
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose); |
|
|
|
|
if (issync == false) |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo |
|
|
|
|
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance) |
|
|
|
|
{ |
|
|
|
|
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; |
|
|
|
@ -470,7 +481,10 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo(false, false, false, null, null); |
|
|
|
|
if (issync == false) |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo(false, false, false, null, null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//GetComponent<FireManWaterHoseManager>().WaterHoseLenghtRemain = |
|
|
|
|
// GetComponent<FireManWaterHoseManager>().NowRemainWaterHose * 20 + ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().RemainLenght;//+ GetComponent<FireManWaterHoseManager>().OverLenght; |
|
|
|
@ -497,7 +511,7 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 结束铺设,放下水带 |
|
|
|
|
/// </summary> |
|
|
|
|
public void EndLay() |
|
|
|
|
public void EndLay(bool issync = false, bool isstoplayskill = true) |
|
|
|
|
{ |
|
|
|
|
//endlay(); |
|
|
|
|
if (flag) |
|
|
|
@ -505,7 +519,7 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
flag = false; |
|
|
|
|
agent.SetDestination(transform.position); //停止移动 |
|
|
|
|
SetLayHoseInfo(); |
|
|
|
|
SetLayHoseInfo(issync, isstoplayskill); |
|
|
|
|
//lengthDic.Clear();//清空本次绘制存储的线 |
|
|
|
|
//IsTackUp = false; |
|
|
|
|
//TackHose = null; |
|
|
|
@ -521,9 +535,9 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 结束铺设时设置该铺设管线信息 |
|
|
|
|
/// </summary> |
|
|
|
|
void SetLayHoseInfo() |
|
|
|
|
void SetLayHoseInfo(bool issync = false, bool isstoplayskill = true) |
|
|
|
|
{ |
|
|
|
|
// LastLenght = GetSelfConsumedLength() - ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().LineLenght; |
|
|
|
|
// LastLenght = GetSelfConsumedLength() - ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().LineLenght; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().LineLenght = GetSelfConsumedLength(); |
|
|
|
@ -546,12 +560,39 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
{ |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().BindWaterSource(false, false, null, null); |
|
|
|
|
} |
|
|
|
|
if (GetComponent<FireManControl>().workType==FireManSkills.SprayFoam|| |
|
|
|
|
if (GetComponent<FireManControl>().workType == FireManSkills.SprayFoam || |
|
|
|
|
GetComponent<FireManControl>().workType == FireManSkills.SprayWater) |
|
|
|
|
{ |
|
|
|
|
GetComponent<AgentController>().pathFindEnable = false; |
|
|
|
|
} |
|
|
|
|
// StartCoroutine(closespraytoggle()); |
|
|
|
|
//if (!(endPoint != Vector3.zero && Vector3.Distance(transform.position, endPoint) < 5)) |
|
|
|
|
//{ |
|
|
|
|
// if (FireManSkillPanelController.Instance) |
|
|
|
|
// { |
|
|
|
|
// FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn = false; |
|
|
|
|
// FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = false; |
|
|
|
|
// } |
|
|
|
|
//} |
|
|
|
|
if (issync == false) |
|
|
|
|
{ |
|
|
|
|
GetComponent<FireManWaterHoseManager>().Resert(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
IEnumerator closespraytoggle() |
|
|
|
|
{ |
|
|
|
|
yield return new WaitForSeconds(0.2f); |
|
|
|
|
if (GetComponent<FireManControl>().WorkType != FireManSkills.SprayFoam && |
|
|
|
|
GetComponent<FireManControl>().WorkType != FireManSkills.SprayWater || |
|
|
|
|
!FireManSkillPanelController.Instance.extinguishantSelect.gameObject.activeSelf) |
|
|
|
|
{ |
|
|
|
|
//if (FireManSkillPanelController.Instance) |
|
|
|
|
{ |
|
|
|
|
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn = false; |
|
|
|
|
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/// <summary> |
|
|
|
|
/// 收起水带 |
|
|
|
@ -719,7 +760,7 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
hose.transform.parent = WaterHoses.transform; |
|
|
|
|
hose.transform.forward = (shuiqiang.position - transform.position).normalized;//改变朝向 |
|
|
|
|
float distance = Vector3.Distance(transform.position, shuiqiang.position); |
|
|
|
|
hose.transform.localScale = new Vector3(25,25, distance * 78);//延长线条,连接两点 |
|
|
|
|
hose.transform.localScale = new Vector3(25, 25, distance * 78);//延长线条,连接两点 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -891,18 +932,27 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
} |
|
|
|
|
public void SetWaterInfoWhileSpray() |
|
|
|
|
{ |
|
|
|
|
if (ParentLayHose!=null&& ParentLayHose.GetComponent<ParentLayWaterHoseMsg>()!=null) |
|
|
|
|
if (ParentLayHose != null && ParentLayHose.GetComponent<ParentLayWaterHoseMsg>() != null) |
|
|
|
|
{ |
|
|
|
|
if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null) |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo |
|
|
|
|
if ((endPoint != Vector3.zero && Vector3.Distance(transform.position, endPoint) < 5)) |
|
|
|
|
{ |
|
|
|
|
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo |
|
|
|
|
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource, |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose); |
|
|
|
|
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance) |
|
|
|
|
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance) |
|
|
|
|
{ |
|
|
|
|
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; |
|
|
|
|
DrawByTimespan(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; |
|
|
|
|
LoadPromptWin.Instance.LoadTextPromptWindow("距离太远,无法自动拿起管线", 1f); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|