Browse Source

换选时点开出水按钮但是没有选择出水类型处理

develop
曹衍涛 4 years ago
parent
commit
5bc7fef1f1
  1. 48
      Assets/Scripts/GameObjectSelect/ObjSelectCtrl.cs
  2. 11
      Assets/Scripts/Power/FiremanSkill/FireManSkillsPanel.cs

48
Assets/Scripts/GameObjectSelect/ObjSelectCtrl.cs

@ -65,6 +65,25 @@ public class ObjSelectCtrl : MonoBehaviour
if (hitObj == gameObject)
{
if (SelectedObjs.selectedCharacters.Count>0)
{
if (gameObject != SelectedObjs.selectedCharacters[0])
{
if(FireManSkillsPanel.GetInstance.gameObject.activeInHierarchy)
{//目前是单选消防员状态
if (SelectedObjs.selectedCharacters[0].GetComponent<FireManMessage>().workType == FireManSkills.SprayWater)
{
if (!SelectedObjs.selectedCharacters[0].GetComponentInChildren<ParticleControlOfType>())
{//单选的是消防员但是没有出水
//点击出水按钮但是没有选择出水类型导致
SelectedObjs.selectedCharacters[0].GetComponent<FireManMessage>().workType = FireManSkills.None;
}
}
}
}
}
clearSelection();
if (hitObj.tag != "Player")
@ -88,9 +107,26 @@ public class ObjSelectCtrl : MonoBehaviour
private void EscCancelSelected(IMessage obj)
{
if (SelectedObjs.selectedObj == gameObject || SelectedObjs.selectedCharacters.Contains(gameObject))
{
if (SelectedObjs.selectedCharacters.Count > 0)
{//目前是单选消防员状态
//if (FireManSkillsPanel.GetInstance.gameObject.activeInHierarchy)
{
if (SelectedObjs.selectedCharacters[0].GetComponent<FireManMessage>().workType == FireManSkills.SprayWater)
{//当前是出水技能但是没有水粒子
if (!SelectedObjs.selectedCharacters[0].GetComponentInChildren<ParticleControlOfType>())
{
SelectedObjs.selectedCharacters[0].GetComponent<FireManMessage>().workType = FireManSkills.None;
}
}
}
}
clearSelection();
}
}
private void CancelObjSelected(IMessage obj)
{
//AddRecordEventSelect(RecordEventType.CancelObjSelected);
@ -163,18 +199,6 @@ public class ObjSelectCtrl : MonoBehaviour
DoDisSelect(SelectedObjs.selectedObj);
SelectedObjs.selectedObj = null;
}
if (FireManSkillsPanel.GetInstance.gameObject.activeInHierarchy)
{
if (FireManSkillsPanel.GetInstance.GetSprayOn())
{
if (FireManSkillsPanel.GetInstance.chooseObj.GetComponentInChildren<ParticleControlOfType>() == null)
{
FireManSkillsPanel.GetInstance.CloseSprayToggle();
}
}
}
for (int i = SelectedObjs.selectedCharacters.Count - 1; i >= 0; i--)
{
DoDisSelect(SelectedObjs.selectedCharacters[i]);

11
Assets/Scripts/Power/FiremanSkill/FireManSkillsPanel.cs

@ -56,7 +56,15 @@ public class FireManSkillsPanel : ResourceLoadPanel<FireManSkillsPanel>
}
public void CloseSprayToggle()
{
//if (!chooseObj.GetComponentInChildren<ParticleControlOfType>())
//{
// if (chooseObj.GetComponent<FireManMessage>().workType == FireManSkills.SprayWater)
// {
// chooseObj.GetComponent<FireManMessage>().workType = FireManSkills.None;
// }
//}
sprayWater.isOn = false;
}
public bool GetSprayOn()
{
@ -256,7 +264,7 @@ public class FireManSkillsPanel : ResourceLoadPanel<FireManSkillsPanel>
/// </summary>
void SetToggle()
{
if (this==null)
if (this == null)
{
return;
}
@ -288,6 +296,7 @@ public class FireManSkillsPanel : ResourceLoadPanel<FireManSkillsPanel>
}
}
void SetHasWater(GameObject gameObject)
{
if (this==null)

Loading…
Cancel
Save