public virtual IEnumerator <float> FleeBattleSequence() { Timing.RunCoroutine(BattleMusicManager.StopAudio(1)); BattleEvents.FleeBattleEvent.Raise(); BattleInput._controls.Disable(); EventSystem.current.sendNavigationEvents = false; yield return(Timing.WaitForSeconds(0.5f)); foreach (var member in membersForThisBattle.Where(member => !member.IsDead)) { var position = member.Unit.transform.position; var newPosition = new Vector3(position.x, position.y, position.z - 15); member.Unit.EmptyAnimations(); member.Unit.anim.SetInteger(AnimationHandler.AnimState, 0); member.Unit.anim.SetFloat(AnimationHandler.HorizontalHash, -1); member.Unit.anim.SetBool(AnimationHandler.IsWalkingHash, true); member.Unit.anim.SetBool(AnimationHandler.IsRunningHash, true); member.Unit.transform.DOMove(newPosition, 2); } //yield return Timing.WaitForSeconds(1.5f); MainInventory.ResetHealingItems(); SceneLoadManager.LoadOverworld(); }
public override IEnumerator <float> FleeBattleSequence() { // TODO: Prevent Flee Option //StopAllCoroutines(); BattleEvents.FleeBattleEvent.Raise(); yield return(Timing.WaitForSeconds(0.5f)); foreach (var member in membersForThisBattle.Where(member => !member.IsDead)) { var position = member.Unit.transform.position; var newPosition = new Vector3(position.x, position.y, position.z - 15); member.Unit.EmptyAnimations(); member.Unit.anim.SetInteger(AnimationHandler.AnimState, 0); member.Unit.anim.SetFloat(AnimationHandler.HorizontalHash, -1); member.Unit.anim.SetBool(AnimationHandler.IsWalkingHash, true); member.Unit.anim.SetBool(AnimationHandler.IsRunningHash, true); member.Unit.transform.DOMove(newPosition, 2); } yield return(Timing.WaitForSeconds(1.5f)); SceneLoadManager.LoadOverworld(); }
protected virtual IEnumerator <float> WonBattleSequence() { //AudioController.StopAudio(CommonAudioTypes.MainBattleTheme, true, 2); Timing.RunCoroutine(BattleMusicManager.StopAudio(2)); yield return(Timing.WaitForSeconds(2)); CommonMMFeedbacks.VictoryFeedback.PlayFeedbacks(); yield return(Timing.WaitForSeconds(1)); AudioController.PlayAudio(CommonAudioTypes.VictoryThemeBattle, true); membersForThisBattle.ForEach(member => member.Unit.anim.SetTrigger(AnimationHandler.VictoryTrigger)); yield return(Timing.WaitForSeconds(2f)); battleResults.SetActive(true); var battleResultsUI = battleResults.GetComponent <BattleResultsUI>(); battleResultsUI.DisableUI(); foreach (var member in membersForThisBattle) { member.ResetLevelUpAmount(); var totalXp = expGivers.Sum(giver => giver.CalculateExperience(member.level, member)); var totalClassXp = expGivers.Sum(giver => giver.CalculateExperience(member.currentClass.level, member.currentClass)); member.BattleExpReceived = totalXp; member.AdvanceTowardsNextLevel(totalXp); member.currentClass.AdvanceTowardsNextLevel(totalClassXp); } yield return(Timing.WaitUntilTrue(() => membersForThisBattle. TrueForAll(m => m.Unit.expCoroutineDone && m.Unit.classExpCoroutineDone))); //yield return Timing.WaitUntilTrue(() => BattleInput._controls.Battle.Confirm.triggered); yield return(Timing.WaitForSeconds(0.5f)); yield return(Timing.WaitUntilTrue(() => BattleInput._controls.Battle.Confirm.triggered)); Timing.RunCoroutine(battleResultsUI.ShowLevelUps()); yield return(Timing.WaitForSeconds(0.3f)); yield return(Timing.WaitUntilFalse(() => battleResultsUI.showingLevelUps)); BattleInput._controls.Disable(); SceneLoadManager.LoadOverworld(); membersForThisBattle.ForEach(m => { m.currentClass.statsToIncrease = new List <CharacterStat>(); }); }