Esempio n. 1
0
    // Called when the game state changes
    private void GameStateChanged(GameState a_oldstate, GameState a_newstate)
    {
        if (a_newstate == GameState.transition && Manager.instance.StateController.StateAfterTransition == GameState.battle || a_newstate == GameState.transition && Manager.instance.StateController.StateAfterTransition == GameState.cinematic)
        {
            earthUnit.WalkDirectlyToTile(earthStartingHex, earthStartingDirection);
            lightningUnit.WalkDirectlyToTile(lightningStartingHex, lightningStartingDirection);
        }

        if (a_newstate == GameState.battle)
        {
            earthUnit.CurrentHealth     = earthUnit.MaxHealth;
            lightningUnit.CurrentHealth = lightningUnit.MaxHealth;

            canInteract = true;
            SelectUnit(earthUnit, false);
        }

        else if (Manager.instance.StateController.CurrentGameState == GameState.transition && Manager.instance.StateController.StateBeforeTransition == GameState.battle)
        {
            DeselectUnit();
            canInteract = false;

            if (earthDead)
            {
                SpawnEarthUnit(earthStartingHex).GetComponent <OverworldFollower>().Init();
                GetComponent <OverworldController>().Init();
            }

            if (lightningDead)
            {
                SpawnLightningUnit(lightningStartingHex).GetComponent <OverworldFollower>().Init();
                GetComponent <OverworldController>().Init();
            }
        }
    }