Пример #1
0
    // 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;
            }
        };
    }
Пример #2
0
    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();
        }
    }
Пример #3
0
    private void ChasePlayer()
    {
        trainer.TriggerTrainerBattle();

        SeePlayer.SetActive(true);

        agent.SetDestination(player.position);
        agent.updateRotation = true;
    }
Пример #4
0
 public void OnEnterTrainersView(TrainerController trainer)
 {
     state = GameState.Cutscene;
     StartCoroutine(trainer.TriggerTrainerBattle(playerController));
 }