private IEnumerator WaitTimeAndCheckForDelay(List <Branch> candidates, float time) { float seconds; if (clampSpeedToOne && !instantMode) { seconds = time <= 1 ? 1 : time; } else { seconds = time; } yield return(new WaitForSeconds(seconds)); float delay = Current.Template.PhraseFeature.delay; if (delay > 0) { var coroutine = new CoroutineObject <List <Branch>, float>(this, PlayWithDelay); coroutine.Start(candidates, delay); CurrentDelay = coroutine; } else { Play(candidates); } }
public Effects(Entity newEntity) { entity = newEntity; currEffects = entity.currentEffects; effectOnDelete += (x) => RemoveEffect(x); coroutineObject = new CoroutineObject(entity, EffectMonitoring); coroutineObject.Start(); }
public void LoadGame() { SpawnLog(); InitializeGlobalVariables(); XDocument xDoc = XDocument.Load(_savePath); var anyEndGame = xDoc.Element("save").Element("log").Elements("endGame").Any(); if (anyEndGame) { Debug.Log("Game already ended."); _controller.GameEnded = true; return; } // set startOn var xExecute = xDoc.Element("save").Element("execute"); var executeId = xExecute.Attribute(Const.XmlAliases.ExecuteId).Value; _player.StartOn = ArticyDatabase.GetObject(executeId); // проверить дилей var result = CheckForDelay(xExecute); if (result.remainingInMinutes > 0) { var coroutine = new CoroutineObject <DateTime, float>(_controller, _controller.ExecuteWithDelay); coroutine.Finished += () => { _controller.PlayerStandBy = false; }; coroutine.Start(result.startTime, result.remainingInMinutes); _controller.CurrentDelay = coroutine; } else { _controller.PlayerStandBy = false; } }
public void RunMoveTimer() { moveRoutine = new CoroutineObject(gameComponent, OnMove); moveRoutine.Start(); }