123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class AnimaUI : MonoBehaviour
- {
- // Start is called before the first frame update
- public Animator animaui;
- public BoxCollider[] buttonBoxmanage;
- private float time = 0;
- bool IsExit = true;
- void Start()
- {
- animaui = this.gameObject.GetComponent<Animator>();
- for (int i = 0; i < buttonBoxmanage.Length; i++)
- {
- buttonBoxmanage[i].gameObject.SetActive(false);
- }
- animaui.speed = 0;
- }
- // Update is called once per frame
- void Update()
- {
- if (IsExit == false)
- {
- time += Time.deltaTime;
- if (time >= 3)
- {
- StartCoroutine(ButtonMg(false));
- animaui.SetBool("UIAnima", true);
-
- time = 0;
- for (int i = 0; i < buttonBoxmanage.Length; i++)
- {
- buttonBoxmanage[i].enabled = false;
- }
- IsExit = true;
- }
- // Debug.Log(time + "时长");
- }
- }
- /// <summary>
- /// UI按钮管理
- /// </summary>
- public IEnumerator ButtonMg(bool isOpen)
- {
- yield return new WaitForSeconds(0.7f);
- buttonBoxmanage[0].gameObject.SetActive(isOpen);
- buttonBoxmanage[1].gameObject.SetActive(isOpen);
- buttonBoxmanage[2].gameObject.SetActive(isOpen);
- }
- public void StartButton()
- {
- IsExit = true;
- time = 0;
- animaui.speed = 1;
- animaui.SetBool("UIAnima", false);
- for (int i = 0; i < buttonBoxmanage.Length; i++)
- {
- buttonBoxmanage[i].gameObject.SetActive(true);
- }
- Invoke("Boxmg", 1f);
-
- }
- public void Boxmg()
- {
- for (int i = 0; i < buttonBoxmanage.Length; i++)
- {
- buttonBoxmanage[i].enabled = true;
- }
- }
- public void RayPointenter()
- {
- IsExit = true;
- time = 0;
- }
- /// <summary>
- ///
- /// </summary>
- public void RayPointexit()
- {
- IsExit = false;
- }
- }
|