Example #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         gameController.SetPlayerInputEnabled(false);
         sceneFader.FadeIntoScene(scene);
     }
 }
Example #2
0
    private void Battle()
    {
        //
        // STATE CHANGES
        //

        // if in the battle scene
        if (sceneFader.GetCurrentSceneName().Equals(battleSceneName))
        {
            if (battleEnemy == null)
            {
                // updates all references needed for battle scene
                UpdateReferences();

                // updates the properties of the battle enemy
                UpdateBattleEnemy();

                UpdateBattlePlayer();
            }


            // if the battle has finished

            // if the enemy is at 0 health
            if (battleController.GetBattleState() == BattleState.End)
            {
                if (battleController.GetPlayerWon())
                {
                    gameState = GameState.TransitionToOverworld;
                }
                else
                {
                    sceneFader.FadeIntoScene("MainMenu");
                }
            }
        }
    }