Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using UnityEngine;
- // Wait for a simple boolean predicate to be true. Example:
- //
- // private IEnumerator HandleDeath() {
- // yield return new WaitWhile(() => hitPoints != 0);
- // Instantiate(SuperCoolDeathFXPrefab);
- // }
- //
- class WaitWhile : CustomYieldInstruction
- {
- private Func<bool> predicate;
- public override bool keepWaiting { get { return predicate(); } }
- public WaitWhile(Func<bool> predicate) { this.predicate = predicate; }
- }
Add Comment
Please, Sign In to add comment