209 lines
5.4 KiB
C#
209 lines
5.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class CharacterInturn : MonoBehaviour
|
|
{
|
|
|
|
private Button recubtn;//안賭객큐
|
|
private Button disbtn;//토든芎객큐
|
|
private Button connectgun;//젯쌈彊퓜객큐
|
|
private Button connectfa;//젯쌈彊랫객큐
|
|
private Button openfa;//댔역彊랫객큐
|
|
//private Image Timermusk;
|
|
//private Text TimerText;
|
|
|
|
private CharacterAin Characterain;
|
|
|
|
private int XfsStep = 0;
|
|
|
|
public GameObject cha;
|
|
public GameObject xfs;
|
|
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>();
|
|
//Timermusk = GameObject.Find("Canvas/xfs/Timerbg/Timermusk").GetComponent<Image>();
|
|
//TimerText = GameObject.Find("Canvas/xfs/Timerbg/Timermusk/Timernumer").GetComponent<Text>();
|
|
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()//안賭꾸鱗
|
|
{
|
|
Characterain.SetSkillAin(CharacterSkill.Rescue);
|
|
StartCoroutine(Rescuereturn(7f));
|
|
}
|
|
|
|
void disClick()//토든芎꾸鱗
|
|
{
|
|
|
|
|
|
}
|
|
|
|
void CgunClick()//젯쌈彊퓜꾸鱗
|
|
{
|
|
if (XfsStep == 0)
|
|
{
|
|
//獵契꾸鱗땡뺌
|
|
Debug.Log("젯쌈彊퓜");
|
|
CoGunHide(0);
|
|
XfsStep++;
|
|
StartCoroutine(AnimTime(6f));
|
|
Characterain.SetSkillAin(CharacterSkill.OperateSuccess);
|
|
}
|
|
else
|
|
{
|
|
|
|
//獵契꾸鱗呵겨땡뺌
|
|
Debug.Log("꾸鱗呵겨,路劤역迦");
|
|
XfsStep = 0;
|
|
CoGunHide(0);
|
|
StartCoroutine(AnimTime(2f));
|
|
Characterain.SetSkillAin(CharacterSkill.OperateFail);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void CfaClick()//젯쌈彊랫꾸鱗
|
|
{
|
|
if (XfsStep == 1)
|
|
{
|
|
//獵契꾸鱗땡뺌
|
|
Debug.Log("젯쌈彊랫");
|
|
CoGunHide(1);
|
|
XfsStep++;
|
|
StartCoroutine(AnimTime(6f));
|
|
connectfa.gameObject.SetActive(false);
|
|
Characterain.SetSkillAin(CharacterSkill.OperateSuccess);
|
|
}
|
|
else
|
|
{
|
|
//獵契꾸鱗呵겨땡뺌
|
|
XfsStep = 0;
|
|
CoGunHide(0);
|
|
StartCoroutine(AnimTime(2f));
|
|
Characterain.SetSkillAin(CharacterSkill.OperateFail);
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void OfaClick()//댔역彊랫꾸鱗
|
|
{
|
|
if (XfsStep == 2)
|
|
{
|
|
//獵契꾸鱗땡뺌
|
|
Debug.Log("댔역彊랫");
|
|
CoGunHide(1);
|
|
XfsStep++;
|
|
StartCoroutine(AnimTime(6f));
|
|
Characterain.SetSkillAin(CharacterSkill.OperateSuccess);
|
|
|
|
}
|
|
else
|
|
{
|
|
//獵契꾸鱗呵겨땡뺌
|
|
XfsStep = 0;
|
|
CoGunHide(0);
|
|
StartCoroutine(AnimTime(2f));
|
|
Characterain.SetSkillAin(CharacterSkill.OperateFail);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IEnumerator AnimTime(float timer)
|
|
{
|
|
TimerMgr.Instance.StartCooldown(timer, HandleCooldownFinished); // 눈흙잤홱珂쇌뵨써監慤숭
|
|
yield return null;
|
|
}
|
|
|
|
void HandleCooldownFinished()//侶쟁警속寧몸慤숭痰윱뇹잿셕珂포잤홱세減빈돨쭉서
|
|
{
|
|
Characterain.SetSkillAin(CharacterSkill.NoSkill);
|
|
CoApper();
|
|
}
|
|
|
|
IEnumerator Rescuereturn(float timer)//赳넋茄君npc굳안賭냥묘빈쏵契낮잼
|
|
{
|
|
recubtn.gameObject.SetActive(false);
|
|
TimerMgr.Instance.StartCooldown(timer,HandleRescue);
|
|
yield return null;
|
|
|
|
|
|
}
|
|
void HandleRescue()
|
|
{
|
|
Characterain.SetSkillAin(CharacterSkill.NoSkill);
|
|
cha.GetComponent<RecuseNpc>().Setnpcstate();
|
|
}
|
|
void CoGunHide(int Hide)//獵契땡鱗퍅쇌뚤객큐쏵契茶꾜
|
|
{
|
|
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()//鞫刻뎠품꼍朧壇맡놔君돨객큐
|
|
{
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|