private void OnAnimEvent(Animator animator, AnimEventPayload animEvent) { if (animEvent.key == STARS_KEY && animEvent.value == _numStars) { // TODO: this was a quick hack to splice some animations together float delay = _numStars == 3 ? 1.3f : _numStars == 2 ? 0.7f : 0.6f; CoroutineRunner.WaitSecondsThenRun(delay, () => { animator.StopPlayback(); animator.enabled = false; _tallyAnimation.Play(); }); } }
/// <summary> /// Load the static level config for the given level. The file can be in PersistentDataPath, /// StreamingAssets, or Resources, in that order; the first file found will be loaded. /// See GetLevelResourceName() for the filename format. /// </summary> /// <param name="levelIndex">The index of the level config to be loaded.</param> /// <param name="callback">Returns the loaded config. Can not be null.</param> public static void LoadAsync(int levelIndex, Action <int, LevelConfig> callback) { CoroutineRunner.Run(LoadAsync_Coroutine(levelIndex, callback)); }
public static void Initialize() { CoroutineRunner.Run(LoadWords_Coroutine((wm) => { Words = wm; })); }
private void OnDestroy() { Instance = null; }
private void Awake() { Assert.IsTrue(Instance == null, "[CoroutineRunner] CoroutineRunner is a singleton"); Instance = this; }