public void OnEnterTrainersView(TrainerController trainer) { bool battleLost = false; foreach (string trainerName in GameController.Instance.DefeatedTrainerName) { if (trainer.Name == trainerName) { battleLost = true; break; } else { battleLost = false; } } if (!battleLost) { state = GameState.Cutscene; StartCoroutine(trainer.TriggerTrainerBattle(playerController)); } else { trainer.BattleLost(); } }
//Here the UI for the end of the battle (or beginning of the game) gets setup void EndBattle(bool won) { if (trainer != null && won == true) { trainer.BattleLost(); trainer = null; } state = GameState.FreeRoam; battleSystem.gameObject.SetActive(false); worldCamera.gameObject.SetActive(true); }
void EndBattle(bool won) { if (trainer != null && won == true) { trainer.BattleLost(); trainer = null; } BattleMusic.Stop(); state = GameState.FreeRoam; battleSystem.gameObject.SetActive(false); worldCamera.gameObject.SetActive(true); playerController.Velocity = 10; }
//Change our battle state, camera active, and gameobject of the Battle System void EndBattle(bool won) { if (trainer != null) { if (won) //If it is a trainer battle, won by the player { trainer.BattleLost(); //Disable the fov, to disable the battle defeatedTrainerName.Add(trainer.Name); trainer = null; } else //If we lose the battle { playerController.LoseBattle(); } } state = GameState.FreeRoam; battleSystem.gameObject.SetActive(false); worldCamera.gameObject.SetActive(true); }
// Method to signal the end of the battle and setting the battle scene to false. void EndBattle(bool won) { if (won == true) //true means trainer lost and false means trainer won. { AudioManager.Instance.PlayMusicWithFade(VictoryMusic, 0.1f); Debug.Log("trainer lost"); trainer.BattleLost(); battleLoader.FadetoBlack(); } else { Debug.Log("trainer won"); trainer.BattleWon(); battleLoader.FadetoBlack(); } state = GameState.FreeRoam; AudioManager.Instance.PlayMusicWithFade(LevelMusic, 0.1f); battleLoader.UnFade(); trainer.TrainerUnit.disableImage(); //have to disable image here or will have overlap as we are calling instance of same trainerunit scripts and when battle ends didnt account for this image BattleSystem.Instance.gameObject.SetActive(false); worldCamera.gameObject.SetActive(true); }