Пример #1
0
        // When the player goes into this scene, the game is set to start the battle
        private void Start()
        {
            if (FindObjectOfType <BattleEvent>() != null)
            {
                currentBattleEvent = FindObjectOfType <BattleEvent>();
            }

            SpawnParty();
            SpawnEnemies();
            DetermineOrderOfAttacks();
            currentTurnIndex = 0;

            currentState = BattleStates.START;
            GameManager.Instance.CurrentState = GameStates.BATTLE;
        }
Пример #2
0
        // A special method that is only called when we come back from a battle
        private IEnumerator ResetSceneAfterBattle()
        {
            // In here, we need to get the BattleEvent Object, so we will find it, since it has not been destroyed
            BattleEvent prevBattle = gameObject.GetComponentInChildren<BattleEvent>();
            mainCamera = GameObject.FindWithTag("MainCamera").GetComponent<CameraController>();
            player = GameObject.FindWithTag("Player");

            // We reset the player and camera positions
            prevBattle.ResetPlayerAndCamera();
            mainCamera.objectToFollow = player.transform;
            Destroy(prevBattle.gameObject);
            yield return null;

            // We fade into the scene
            GameObject.FindWithTag("FadeUI").GetComponent<Image>().CrossFadeAlpha(0, 0.5f, true);
            yield return new WaitForSeconds(0.5f);

            // We enable the player to move and the game resumes
            CurrentState = GameStates.NORMAL;
        }