void Start()
    {
        #region "Singleton"
        if (turnController == null)
        {
            turnController = this;
        }
        else
        {
            Destroy(this);
        }
        #endregion

        fighters      = new List <Fighter>();
        fighters_turn = 2;

        GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
        Debug.Log("Jugadores agregados");
        players_cant = players.Length;
        Debug.Log(players_cant);

        GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
        Debug.Log("Enemigos agregados");
        enemies_cant = enemies.Length;
        Debug.Log(enemies_cant);

        foreach (GameObject player in players)
        {
            Fighter temp = player.GetComponent <Fighter>();
            Debug.Log(temp);

            if (player_1 == null)
            {
                player_1 = temp;
            }
            else
            {
                player_2 = temp;
            }

            fighters.Add(temp);
        }
        foreach (GameObject enemy in enemies)
        {
            Fighter temp = enemy.GetComponent <Fighter>();
            Debug.Log(temp);

            /*Buscar como agregarlos dinamicamente para seleccionar enemigo o aliado*/
            if (enemy_1 == null)
            {
                enemy_1 = temp;
            }
            else
            {
                enemy_2 = temp;
            }

            fighters.Add(temp);
        }

        fighters_cant = fighters.Count;

        battleLoseEvent        = new BattleLoseEvent();
        battleWinEvent         = new BattleWinEvent();
        objectiveSelectedEvent = new ObjectiveSelectedEvent();
        endTurnEvent           = new EndTurnEvent();

        if (enemySelected == null)
        {
            enemySelected = enemies[Random.value > 0.5f ? 0 : 1];
        }
        if (playerSelected == null)
        {
            playerSelected = players[Random.value > 0.5 ? 0 : 1];
        }
        if (fighterSelected == null)
        {
            fighterSelected = (Random.value > 0.5f ? playerSelected : enemySelected);
        }

        fighters_turn = (int)Random.Range(0, 3);

        this.NextTurn();

        StartCoroutine(ObjectiveSelected());
        StartCoroutine(MoveSpotlight());
    }
 void OpenEndedGamePanel(BattleWinEvent evento)
 {
     GameEndedPanel.SetActive(true);
 }
Beispiel #3
0
 void BattleWon(BattleWinEvent evento)
 {
     Debug.Log("Ganaste.");
     ScreenLog.log.AddEvent("Ganaste! TuT");
 }