12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using ChivaXR;
- using System;
- public class AniDriver_WaitFrameToActiveObjs : AnimationDriverBase
- {
- public int waitFrames;
-
- public float aniFPS = 30;
- public List<GameObject> objs = new List<GameObject>();
- public bool activeObjs;
- public override void FinishedState()
- {
- foreach (var item in objs)
- {
- item.SetActive(activeObjs);
- }
- }
- public override void InitState()
- {
- foreach (var item in objs)
- {
- item.SetActive(!activeObjs);
- }
- }
- public override void StartPlay(Action finishedCallBack = null)
- {
- StartAniCoroutine(WaitFrame(finishedCallBack));
- }
- IEnumerator WaitFrame(Action finishedCallBack)
- {
- yield return new WaitForSeconds(waitFrames / aniFPS);
- foreach (var item in objs)
- {
- item.SetActive(activeObjs);
- }
- finishedCallBack?.Invoke();
- }
- }
|