You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
812 B
39 lines
812 B
7 months ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class Tester : MonoBehaviour
|
||
|
{
|
||
|
private Coroutine _crtn;
|
||
|
|
||
|
private void Start()
|
||
|
{
|
||
|
this._crtn = this.StartCoroutine(this.HandleAnim());
|
||
|
}
|
||
|
|
||
|
private IEnumerator HandleAnim()
|
||
|
{
|
||
|
float progress = 0f;
|
||
|
float invDur = 1f / 5f;
|
||
|
|
||
|
while (progress < 1f)
|
||
|
{
|
||
|
yield return new WaitForSeconds(0.2f);
|
||
|
progress = Mathf.Clamp01(progress + (0.2f * invDur));
|
||
|
|
||
|
// Do something with progress
|
||
|
Debug.Log(progress);
|
||
|
}
|
||
|
|
||
|
yield return this.StartCoroutine(this.subCoroutine());
|
||
|
|
||
|
// Cleanup?
|
||
|
this._crtn = null;
|
||
|
}
|
||
|
|
||
|
private IEnumerator subCoroutine()
|
||
|
{
|
||
|
yield return new WaitForSeconds(1f);
|
||
|
}
|
||
|
}
|