|
|
|
@ -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() |
|
|
|
@ -156,12 +156,12 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
// Update is called once per frame |
|
|
|
|
void Update() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Debug.Log(flag+"//"+ agent.velocity.magnitude ); |
|
|
|
|
if (flag && agent.velocity.magnitude > 0) //开启“铺设水带”,并且开始寻路时才会执行 |
|
|
|
|
{ |
|
|
|
|
remainlenght = GetComponent<FireManWaterHoseManager>().WaterHoseLenghtRemain; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endPoint = transform.position; |
|
|
|
|
//LayLenght= GetSelfConsumedLength(); |
|
|
|
|
if (remainlenght > 0 && remainlenght <= 0.5f) //临界带 |
|
|
|
@ -173,7 +173,7 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
LoadPromptWin.Instance.LoadTextPromptWindow("水带用完", 1f); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrawByTimespan();//按更新的铺设路线画一次水带 |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -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++; |
|
|
|
@ -358,7 +358,7 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
AddInit(); |
|
|
|
|
endPoint = transform.position; |
|
|
|
|
flag = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//如果放下期间没有被别人捡起,继续铺设 |
|
|
|
|
else |
|
|
|
@ -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; |
|
|
|
@ -419,12 +426,12 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
FireManWaterHoseManager thisFireman = GetComponent<FireManWaterHoseManager>(); |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().BindWaterSource(thisFireman.hasWaterConnect, thisFireman.hasFoamConnect, thisFireman.ConnentSource, thisFireman.WaterLineConnent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allInits.Clear(); |
|
|
|
|
AddInit(); |
|
|
|
|
endPoint = transform.position; |
|
|
|
|
flag = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -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,11 +535,11 @@ 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(); |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().UseNum = Mathf.CeilToInt(GetSelfConsumedLength() / 20); |
|
|
|
|
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().CreatFireman = gameObject; |
|
|
|
@ -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> |
|
|
|
|
/// 收起水带 |
|
|
|
@ -895,14 +936,23 @@ public class LayWaterHose : MonoBehaviour
|
|
|
|
|
{ |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|