public bool LogInUser(string email, string password) { if (_authController.VerifyLoginInput(email, password)) { bool loginSuccess = true; switch (_authController.LogInUser(email, password, _playerRepository, _trainerRepository, _adminRepository)) { case "player": { var form = _formsFactory.PlayerView(); _playerController.Homepage(form, this, _playerRepository.GetPlayerByEmail(email), _transactionRepository, _trainerRepository, _trainingRepository, _teamRepository); break; } case "trainer": { var form = _formsFactory.TrainerView(); var trainerController = new TrainerController(); trainerController.Homepage(form, this, _trainerRepository.GetTrainerByEmail(email), _trainerRepository, _trainingRepository, _teamRepository, _playerRepository); break; } case "admin": { var form = _formsFactory.AdminView(); _adminController.Homepage(form, this, _adminRepository.GetAdminByEmail(email), _playerRepository, _trainerRepository, _teamRepository, _transactionRepository); break; } case "": loginSuccess = false; break; } return(loginSuccess); } return(false); }
// Start is called before the first frame update. If the player enters the trainer's view, the battle will be triggered. private void Start() { battleSystem.Awake(); BattleSystem.Instance.onBattleOver += EndBattle; playerController.onEnterTrainersView += (Collider2D trainerCollider) => { var trainer = trainerCollider.GetComponentInParent <TrainerController>(); this.trainer = trainer; if (trainer != null) { state = GameState.Cutscene; StartCoroutine(trainer.TriggerTrainerBattle(playerController)); } }; DialogManager.Instance.OnShowDialog += () => { state = GameState.Dialog; }; DialogManager.Instance.OnCloseDialog += () => { if (state == GameState.Dialog) { state = GameState.FreeRoam; } }; }
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(); } }
public void StartTrainerBattle(PokemonParty playerParty, PokemonParty trainerParty) { this.playerParty = playerParty; this.trainerParty = trainerParty; isTrainerBattle = true; player = playerParty.GetComponent <PlayerController>(); trainer = trainerParty.GetComponent <TrainerController>(); StartCoroutine(SetupBattle()); }
public void StartTrainerBattle(TrainerController trainer) { state = GameState.Battle; battleSystem.gameObject.SetActive(true); worldCamera.gameObject.SetActive(false); this.trainer = trainer; var playerParty = playerController.GetComponent <PokemonParty>(); var trainerParty = trainer.GetComponent <PokemonParty>(); battleSystem.StartTrainerBattle(playerParty, trainerParty); }
//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); }
public TrainerPage( TrainerController trainerCtrl, DataFilesStorageController dataFilesStorageCtrl, ModelFilesStorageController modelFilesStorageCtrl, PDataFilesStorageController pDataFilesStorageCtrl) { DataFilesStorageCtrl = dataFilesStorageCtrl ?? throw new ArgumentNullException(); ModelFilesStorageCtrl = modelFilesStorageCtrl ?? throw new ArgumentNullException(); PDataFilesStorageCtrl = pDataFilesStorageCtrl ?? throw new ArgumentNullException(); TrainerCtrl = trainerCtrl ?? throw new ArgumentNullException(); InitializeComponent(); }
TrainerController trainer; //Reference the trainer public void StartTrainerBattle(TrainerController trainer) { state = GameState.Battle; battleSystem.gameObject.SetActive(true); worldCamera.gameObject.SetActive(false); this.trainer = trainer; //Set THIS specific trainer as our reference var playerParty = playerController.GetComponent <PokemonParty>(); //Store our party in a var var trainerParty = trainer.GetComponent <PokemonParty>(); //Store the trainer party in a var battleSystem.StartTrainerBattle(playerParty, trainerParty); //Call our StartBattle, so every fight are not the same }
public void StartTrainerBattle(PokemonParty playerParty, PokemonParty trainerParty) //Beggin the trainer battle { this.playerParty = playerParty; //this. is to use the variable and not the parameter this.trainerParty = trainerParty; spriteRenderer = GetComponent <SpriteRenderer>(); isTrainerBattle = true; player = playerParty.GetComponent <PlayerController>(); //Set a reference the player party trainer = trainerParty.GetComponent <TrainerController>(); //Same with trainer StartCoroutine(SetupBattle()); //We call our SetupBattle function }
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; }
public void StartTrainerBattle(CreatureTeam playerteam, CreatureTeam trainerTeam) { //wierd use of the same name just to make it work in script this.playerteam = playerteam; this.trainerteam = trainerTeam; ////for trainer battle, bug fix to false isTrainerBattle = true; //player = playerteam.GetComponent<PlayerController3D>(); player = playerteam.GetComponent <PlayerController360>(); trainer = trainerteam.GetComponent <TrainerController>(); StartCoroutine(SetUpBattle()); }
private void Awake() { if (Instance == null) { Instance = this; } Skills = XmlParser <Skill> .ParseXmlFromText(((TextAsset)Resources.Load("Xml/" + /*JOB*/ "GNB")).text); foreach (var skill in Skills) { _debugText.text = _debugText.text + System.Environment.NewLine + "skill: " + skill.Name; } _gcdValueInput.onEndEdit.AddListener(delegate { GcdValueUpdate(); }); }
public void StartTrainerBattle(TrainerController trainer) { if (state != GameState.Battle) //Preventing from entering a battle when already in one. { //Player.SetActive(false); state = GameState.Battle; battleSystem.gameObject.SetActive(true); freeroamCam.gameObject.SetActive(false); //used to return the player creatures //var playerTeam = playerController3D.GetComponent<CreatureTeam>(); var playerTeam = playerController360.GetComponent <CreatureTeam>(); var trainerTeam = trainer.GetComponent <CreatureTeam>(); battleSystem.StartTrainerBattle(playerTeam, trainerTeam); } }
//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); }
void Awake() { Instance = this; }
public void OnEnterTrainersView(TrainerController trainer) { state = GameState.Cutscene; StartCoroutine(trainer.TriggerTrainerBattle(playerController)); }