2024-10-24 12:46:20 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
public class CharacterInturn : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private Button recubtn;//<2F><>Ԯ<EFBFBD><D4AE>ť
|
|
|
|
|
private Button disbtn;//<2F><><EFBFBD><EFBFBD><EFBFBD>䰴ť
|
|
|
|
|
private Button connectgun;//<2F><><EFBFBD><EFBFBD>ˮǹ<CBAE><C7B9>ť
|
|
|
|
|
private Button connectfa;//<2F><><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>ť
|
|
|
|
|
private Button openfa;//<2F><><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>ť
|
2024-10-24 18:01:55 +08:00
|
|
|
|
|
2024-10-24 12:46:20 +08:00
|
|
|
|
|
|
|
|
|
private CharacterAin Characterain;
|
|
|
|
|
|
|
|
|
|
private int XfsStep = 0;
|
|
|
|
|
|
|
|
|
|
public GameObject cha;
|
|
|
|
|
public GameObject xfs;
|
2024-10-24 18:01:55 +08:00
|
|
|
|
|
2024-10-24 12:46:20 +08:00
|
|
|
|
private GameObject timer;
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
xfs = GameObject.Find("Canvas/xfs");
|
|
|
|
|
|
|
|
|
|
recubtn = GameObject.Find("Canvas/Recuse").GetComponent<Button>();
|
|
|
|
|
disbtn = GameObject.Find("Canvas/Distribution box").GetComponent<Button>();
|
|
|
|
|
connectgun = GameObject.Find("Canvas/xfs/ConnectGun").GetComponent<Button>();
|
|
|
|
|
connectfa = GameObject.Find("Canvas/xfs/ConnectFa").GetComponent<Button>();
|
|
|
|
|
openfa = GameObject.Find("Canvas/xfs/OpenFa").GetComponent<Button>();
|
|
|
|
|
Characterain = this.GetComponent<CharacterAin>();
|
|
|
|
|
//animator = this.GetComponent<Animator>();
|
|
|
|
|
// stateInfo = animator.GetCurrentAnimatorStateInfo(0);
|
|
|
|
|
|
|
|
|
|
timer = GameObject.Find("Canvas/Timer");
|
|
|
|
|
|
|
|
|
|
recubtn.gameObject.SetActive(false);
|
|
|
|
|
disbtn.gameObject.SetActive(false);
|
|
|
|
|
xfs.gameObject.SetActive(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recubtn.onClick.AddListener(Recuse);
|
|
|
|
|
disbtn.onClick.AddListener(disClick);
|
|
|
|
|
connectgun.onClick.AddListener(CgunClick);
|
|
|
|
|
connectfa.onClick.AddListener(CfaClick);
|
|
|
|
|
openfa.onClick.AddListener(OfaClick);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Recuse()//<2F><>Ԯ<EFBFBD><D4AE><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.Rescue);
|
|
|
|
|
StartCoroutine(Rescuereturn(7f));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void disClick()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CgunClick()//<2F><><EFBFBD><EFBFBD>ˮǹ<CBAE><C7B9><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (XfsStep == 0)
|
|
|
|
|
{
|
|
|
|
|
//ִ<>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>ˮǹ");
|
|
|
|
|
CoGunHide(0);
|
|
|
|
|
XfsStep++;
|
2024-10-24 18:01:55 +08:00
|
|
|
|
StartCoroutine(AnimTimeSuccefful(6f));
|
2024-10-24 12:46:20 +08:00
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.OperateSuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//ִ<>в<EFBFBD><D0B2><EFBFBD>ʧ<EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD>
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>¿<EFBFBD>ʼ");
|
|
|
|
|
XfsStep = 0;
|
|
|
|
|
CoGunHide(0);
|
2024-10-24 18:01:55 +08:00
|
|
|
|
StartCoroutine(AnimTimeFail(2f));
|
2024-10-24 12:46:20 +08:00
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.OperateFail);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CfaClick()//<2F><><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (XfsStep == 1)
|
|
|
|
|
{
|
|
|
|
|
//ִ<>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>");
|
|
|
|
|
CoGunHide(1);
|
|
|
|
|
XfsStep++;
|
2024-10-24 18:01:55 +08:00
|
|
|
|
StartCoroutine(AnimTimeSuccefful(6f));
|
2024-10-24 12:46:20 +08:00
|
|
|
|
connectfa.gameObject.SetActive(false);
|
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.OperateSuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//ִ<>в<EFBFBD><D0B2><EFBFBD>ʧ<EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD>
|
|
|
|
|
XfsStep = 0;
|
|
|
|
|
CoGunHide(0);
|
2024-10-24 18:01:55 +08:00
|
|
|
|
StartCoroutine(AnimTimeFail(2f));
|
2024-10-24 12:46:20 +08:00
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.OperateFail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OfaClick()//<2F><><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (XfsStep == 2)
|
|
|
|
|
{
|
|
|
|
|
//ִ<>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>");
|
|
|
|
|
CoGunHide(1);
|
|
|
|
|
XfsStep++;
|
2024-10-24 18:01:55 +08:00
|
|
|
|
StartCoroutine(AnimTimeSuccefful(6f));
|
2024-10-24 12:46:20 +08:00
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.OperateSuccess);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//ִ<>в<EFBFBD><D0B2><EFBFBD>ʧ<EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD>
|
|
|
|
|
XfsStep = 0;
|
|
|
|
|
CoGunHide(0);
|
2024-10-24 18:01:55 +08:00
|
|
|
|
StartCoroutine(AnimTimeFail(2f));
|
2024-10-24 12:46:20 +08:00
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.OperateFail);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-24 18:01:55 +08:00
|
|
|
|
IEnumerator AnimTimeSuccefful(float timer)//<2F><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>ִ<EFBFBD>е<EFBFBD>Э<EFBFBD><D0AD>
|
2024-10-24 12:46:20 +08:00
|
|
|
|
{
|
|
|
|
|
TimerMgr.Instance.StartCooldown(timer, HandleCooldownFinished); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴʱ<C8B4><CAB1><EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
2024-10-24 18:01:55 +08:00
|
|
|
|
yield return null;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator AnimTimeFail(float timer)//<2F><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>ִ<EFBFBD>е<EFBFBD>Э<EFBFBD><D0AD>
|
|
|
|
|
{
|
|
|
|
|
TimerMgr.Instance.StartCooldown(timer, HandleCooldownFinishedFailed);
|
2024-10-24 12:46:20 +08:00
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 18:01:55 +08:00
|
|
|
|
void HandleCooldownFinished()//<2F><><EFBFBD><EFBFBD>˨<EFBFBD><CBA8><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.NoSkill);
|
|
|
|
|
CoApper();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HandleCooldownFinishedFailed()//<2F><><EFBFBD><EFBFBD>˨<EFBFBD><CBA8><EFBFBD><EFBFBD>ʧ<EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ȫ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD>
|
2024-10-24 12:46:20 +08:00
|
|
|
|
{
|
2024-10-24 18:01:55 +08:00
|
|
|
|
PromptMgr.Instance.PromptBubble("<22><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>");
|
2024-10-24 12:46:20 +08:00
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.NoSkill);
|
|
|
|
|
CoApper();
|
2024-10-24 18:01:55 +08:00
|
|
|
|
|
2024-10-24 12:46:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 18:01:55 +08:00
|
|
|
|
IEnumerator Rescuereturn(float timer)//Э<><D0AD>ʵ<EFBFBD><CAB5>npc<70><63><EFBFBD><EFBFBD>Ԯ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD>
|
2024-10-24 12:46:20 +08:00
|
|
|
|
{
|
|
|
|
|
recubtn.gameObject.SetActive(false);
|
|
|
|
|
TimerMgr.Instance.StartCooldown(timer,HandleRescue);
|
|
|
|
|
yield return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-10-24 18:01:55 +08:00
|
|
|
|
void HandleRescue()//<2F><>Ԯ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﶯ<EFBFBD><EFB6AF><EFBFBD><EFBFBD><EFBFBD>еĴ<D0B5><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>npcǰ<63><C7B0>ָ<EFBFBD><D6B8><EFBFBD>ص<EFBFBD><D8B5>Ĵ<EFBFBD><C4B4><EFBFBD>
|
2024-10-24 12:46:20 +08:00
|
|
|
|
{
|
|
|
|
|
Characterain.SetSkillAin(CharacterSkill.NoSkill);
|
|
|
|
|
cha.GetComponent<RecuseNpc>().Setnpcstate();
|
|
|
|
|
}
|
|
|
|
|
void CoGunHide(int Hide)//ִ<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
switch (Hide)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
connectgun.gameObject.SetActive(false);
|
|
|
|
|
connectfa.gameObject.SetActive(false);
|
|
|
|
|
openfa.gameObject.SetActive(false);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
openfa.gameObject.SetActive(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CoApper()//<2F><>ʾ<EFBFBD><CABE>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3>ֵİ<D6B5>ť
|
|
|
|
|
{
|
|
|
|
|
switch (XfsStep)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
connectgun.gameObject.SetActive(true);
|
|
|
|
|
connectfa.gameObject.SetActive(true);
|
|
|
|
|
openfa.gameObject.SetActive(true);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
connectfa.gameObject.SetActive(true);
|
|
|
|
|
openfa.gameObject.SetActive(true);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
openfa.gameObject.SetActive(true);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|