Example #1
0
    IEnumerator SetUpBattle()
    {
        //Finds the Party Manager, and sets the first child to Active
        playerGameObject.transform.GetChild(0).gameObject.SetActive(true);
        playerUnit = playerGameObject.transform.GetChild(0).gameObject.GetComponent <PlayerUnit>(); //gets 'Unit" from first child
        SetSkillButtons();

        //creates the enemy in their location of the battle screen
        SpawnEnemy(2);
        enemyGameObject.transform.GetChild(0).gameObject.SetActive(true);                             //sets first enemy party member to active
        textBox.text = "Battle versus " + enemyUnits[enemyUnitNum].currentUnit.unitName + " begins!"; //battle start message

        //sets the player and enemy HUDs with their stats
        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnits[enemyUnitNum]);

        yield return(new WaitForSeconds(2f));

        if (playerUnit.speed > enemyUnits[enemyUnitNum].speed)
        {
            battleState = BattleState.PlayerTurn;
            PlayerTurn();
        }
        else
        {
            battleState = BattleState.EnemyTurn;
            StartCoroutine(EnemyTurn());
        }
    }
Example #2
0
    IEnumerator SetupBattle()
    {
        // Spawn units
        GameObject p = Instantiate(playerPrefab, new Vector2(-6f, -1.5f), Quaternion.identity);    // player gameobject

        playerUnit = p.GetComponent <Unit>();

        GameObject e = Instantiate(enemyPrefab, new Vector2(6f, 1.75f), Quaternion.identity);       // enemy gameobject

        enemyUnit = e.GetComponent <Unit>();

        // Starting message
        battleText.text = "Rival challenges you to a battle!";

        // Initiate HUD elements
        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        // Add time delay
        yield return(new WaitForSeconds(2f));

        // Player's turn
        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
    // BATTLE SETUP AT THE START OF THE GAME
    IEnumerator SetUpBattle()
    {
        GameObject playerGameObject = Instantiate(playerPrefab, new Vector3(-6.5f, -2f, 0f), Quaternion.identity);

        playerUnit = playerGameObject.GetComponent <Unit>();

        GameObject enemyGameObject = Instantiate(enemyPrefab, new Vector3(6.5f, -2f, 0f), Quaternion.identity);

        enemyUnit = enemyGameObject.GetComponent <Unit>();

        GameObject enemySecondGameObject = Instantiate(enemySecondPrefab, new Vector3(3f, -2.3f, 0f), Quaternion.identity);

        enemySecondUnit = enemySecondGameObject.GetComponent <Unit>();


        attackClickCounter = 0;
        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);
        enemySecondHUD.SetHUD(enemySecondUnit);

        yield return(new WaitForSeconds(.5f));

        currentState = GameState.PLAYER;
        PlayerTurn();
    }
Example #4
0
    IEnumerator SetupBattle()
    {
        dialogueText.EnableStart(true);
        dialogueText.EnableQuestions(false);
        azureSpeech.EnableAzure(false);
        speechLibTest.EnableSpeech(false);
        dialogueText.EnableBag(false);
        endNotice.EnableDie(false);
        endNotice.EnableWin(false);

        GameObject playerGO = Instantiate(playerPrefab, playerBattleStation);

        playerUnit = playerGO.GetComponent <Unit>();

        GameObject enemyGO = Instantiate(enemyPrefab, enemyBattleStation);

        enemyUnit = enemyGO.GetComponent <Unit>();

        yield return(dialogueText.TypeDialogue("Choose an action!"));

        yield return(new WaitForSeconds(1f));

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        state = BattleState.ACTIONS;
    }
Example #5
0
    void SetupBattle()
    {
        //sets up John and Vincent
        if (!johnIn)
        {
            DisableJohn();
        }
        if (!vincentIn)
        {
            DisableVincent();
        }

        nextFightButton.SetActive(false);
        restartButton.SetActive(false);

        turnNum = 1;

        //sets up the player
        playerGO   = Instantiate(playerPrefab, playerBattleStation);
        playerUnit = playerGO.GetComponent <Unit>();

        //sets up the enemy
        GameObject enemyGO = Instantiate(enemyPrefab, enemyBattleStation);

        enemyUnit = enemyGO.GetComponent <Unit>();

        DisableButtons();

        dialogueText.text = "A wild " + enemyUnit.unitName + " approaches...";

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        //wait for Ok button
    }
Example #6
0
    //Method for setting up battle
    IEnumerator SetUpBattle()
    {
        //Spawn the player
        GameObject playerInst = Instantiate(player, playerSpawnPoint);

        //Get reference for unit script
        playerUnit = playerInst.GetComponent <Unit>();
        //Spawn enemy
        GameObject enemyInst = Instantiate(enemy, enemySpawnPoint);

        //Get reference for unit script
        enemyUnit = enemyInst.GetComponent <Unit>();

        //Check for null
        if (dialogueText != null)
        {
            //Display message
            dialogueText.text = enemyUnit.encountermessage;
        }

        //Set the HUD ui
        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        //Wait 2 secs
        yield return(new WaitForSeconds(2f));

        //Call playerTurn
        PlayerTurn();
    }
Example #7
0
    IEnumerator SetUpBattle()
    {
        //Creates the player in their location of the battle screen
        GameObject playerGameObject = Instantiate(playerPrefab, playerBattleStation);

        playerUnit = playerGameObject.GetComponent <Unit>();

        //creates the enemy in their location of the battle screen
        GameObject enemyGameObject = Instantiate(enemyPrefab, enemyBattleStation);

        enemyUnit = enemyGameObject.GetComponent <Unit>();

        //battle start message in the HUD
        textBox.text = "Battle versus " + enemyUnit.unitName + " begins!";

        //sets the player and enemy HUDs with their stats
        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        //changes game state to the player's turn
        battleState = BattleState.PlayerTurn;
        PlayerTurn();
    }
Example #8
0
    IEnumerator SetupBattle()
    {
        GameObject playerGO = Instantiate(playerPrefab, playerBattleStation);

        //playerUnit = playerGO.GetComponent<Unit>();
        playerUnit = BattleInfoBridge.instance.GetPlayer();

        GameObject enemyGo = Instantiate(enemyPrefab, enemyBattleStation);

        enemyUnit = enemyGo.GetComponent <Unit>();
        enemyUnit.initEUnit();
        playerAnimator.runtimeAnimatorController = playerUnit.animc;
        enemyAnimator.runtimeAnimatorController  = enemyUnit.animc;
        //audioSource = BattleInfoBridge.instance.GetEnemy().audioSource;
        audioSource.clip = BattleInfoBridge.instance.GetEnemy().audioSource.clip;
        audioSource.outputAudioMixerGroup = BattleInfoBridge.instance.GetEnemy().audioSource.outputAudioMixerGroup;
        audioSource.Play();
        screenHUD.writeLog("Starting...");
        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        screenHUD.eraseLog();

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
    IEnumerator SetupBattle()
    {
        if (PlayerPrefs.GetString("monsterPrefab") == "GreenMonster")
        {
            enemyGO = monsters[0];
        }
        else
        {
            enemyGO = monsters[1];
        }
        enemy = Instantiate(enemyGO);

        enemyUnit           = enemyGO.GetComponent <Unit>();
        enemyUnit.unitName  = PlayerPrefs.GetString("monsterName");
        enemyUnit.damage    = PlayerPrefs.GetInt("monsterAttack");
        enemyUnit.unitLevel = PlayerPrefs.GetInt("monsterLevel");
        enemyUnit.currentHP = PlayerPrefs.GetInt("monsterHP");
        enemyUnit.maxHP     = PlayerPrefs.GetInt("monsterHP");

        playerUnit.currentHP = PlayerPrefs.GetInt("playerHP");

        dialogueText.text = "This " + enemyUnit.unitName + " is disgusting!";

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        PlayerTurn();
    }
Example #10
0
    public void UpdateHud()
    {
        playerBattleHUD.SetHUD(playerUnit, playerUnit.GetTurnPos());
        if (targetedEnemyUnit != null)
        {
            enemyBattleHUD.SetHUD(targetedEnemyUnit, targetedEnemyUnit.GetTurnPos());
            turnSliders.UpdateTurnBar(playerUnit, enemies);

            if (targetedEnemyUnit.statusEffect != null)
            {
                enemyBattleHUD.SetStatusEffect(targetedEnemyUnit.statusEffect);
            }
            else
            {
                enemyBattleHUD.SetStatusEffect();
            }
        }

        if (playerUnit.statusEffect != null)
        {
            playerBattleHUD.SetStatusEffect(playerUnit.statusEffect);
        }
        else
        {
            playerBattleHUD.SetStatusEffect();
        }
        HUDUpdated.Raise();
    }
    IEnumerator SetupBattle()
    {
        yield return(new WaitForSeconds(1f));

        BattleStart.SetActive(false);

        GameObject PlayerGo = Instantiate(PlayerPrefab, PlayerBattleStation);

        PlayerUnit = PlayerGo.GetComponent <Unit>();

        GameObject EnemeyGo = Instantiate(EnemyPrefab, EnemyBattleStation);

        EnemyUnit = EnemeyGo.GetComponent <Unit>();

        DialogueText.text    = EnemyUnit.UnitName + " Has Appeared!";
        CardCounterText.text = "Gate Cards Won: " + CardCounter;



        PlayerHUD.SetHUD(PlayerUnit);
        EnemyHUD.SetHUD(EnemyUnit);


        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;

        StartCoroutine(PlayerTurn());
    }
Example #12
0
    IEnumerator SetUpBattle(int battleNum)
    {
        playerHUD.SetHUD(player);
        playerHUD.SetHP(player.currentHP);

        int enemyAmount = battleSequences[battleNum].enemyUnits.Length;

        enemyAmountThisRound = enemyAmount;
        for (int i = 0; i < enemyAmount; i++)
        {
            GameObject go = Instantiate(battleSequences[battleNum].enemyUnits[i], transform);
            enemyHUD[i].gameObject.SetActive(true);
            enemyHUD[i].SetHUD(go.GetComponent <Unit>());
            enemyHUD[i].SetHP(enemyHUD[i].enemyUnit.maxHP);
        }



        dialogText.text = battleSequences[battleNum].battleDescription;

        yield return(new WaitForSeconds(3f));

        state = BattleState.PlayerTurn;
        PlayerTurn();
    }
Example #13
0
    IEnumerator SetupBattle()
    {
        Debug.Log("" + opponentChoice);
        GameObject playerGO = Instantiate(playerPrefab, playerBattleStation);

        playerUnit = playerGO.GetComponent <Unit>();


        if (opponentChoice == 1)
        {
            GameObject enemyGO = Instantiate(charizardPrefab, enemyBattleStation);
            enemyUnit = enemyGO.GetComponent <Unit>();
        }
        else if (opponentChoice == 2)
        {
            GameObject enemyGO = Instantiate(pikachuPrefab, enemyBattleStation);
            enemyUnit = enemyGO.GetComponent <Unit>();
        }
        else if (opponentChoice == 3)
        {
            GameObject enemyGO = Instantiate(venusaurPrefab, enemyBattleStation);
            enemyUnit = enemyGO.GetComponent <Unit>();
        }
        else             //default to pikachu in the case that the program is run from Game scene not selection scene
        {
            GameObject enemyGO = Instantiate(pikachuPrefab, enemyBattleStation);
            enemyUnit = enemyGO.GetComponent <Unit>();
        }


        dialogueText.text = "A wild " + enemyUnit.unitName + " appeared!";
        attack1Text.text  = playerUnit.move1 + "";
        attack2Text.text  = playerUnit.move2 + "";
        attack3Text.text  = playerUnit.move3 + "";

        playerHPText.text = playerUnit.currentHP + "/" + playerUnit.maxHP;
        enemyHPText.text  = enemyUnit.currentHP + "/" + enemyUnit.maxHP;

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        combatButtons.SetActive(false);

        yield return(new WaitForSeconds(2f));

        if (playerUnit.speed > enemyUnit.speed)
        {
            state = BattleState.PLAYERTURN;
            PlayerTurn();
        }
        else
        {
            state = BattleState.ENEMYTURN;
            StartCoroutine(EnemyTurn());
        }
    }
Example #14
0
    IEnumerator SetupBattle()
    {
        dialogueText.text = "Vous allez affronter " + enemyUnit.unitName;

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
    IEnumerator SetupBattle()
    {
        PlayerUnit = playerPrefab.GetComponent <Stats>();
        EnemyUnit  = enemyPrefab.GetComponent <Stats>();
        playerHUD.SetHUD(PlayerUnit);
        enemyHUD.SetHUD(EnemyUnit);
        EHalo.SetActive(false);
        yield return(new WaitForSeconds(0));

        State = BattleState.PLAYERTURN;
        PlayerTurn();
    }
    IEnumerator SetupBattle()
    {
        GameObject playerGO = Instantiate(playerPrefab, playerBattleStation);

        playerUnit = playerGO.GetComponent <Unit>();
        //animator = GetComponent<Animator>();
        //animator.SetTrigger("attacking");
        playerUnit.unitName        = Player.name;
        playerUnit.HC              = Player.maxHealth;
        playerUnit.EC              = Player.maxEnergy;
        playerUnit.unitLevel       = Player.level;
        playerUnit.currentHP       = Player.maxHealth;
        playerUnit.currentEP       = Player.maxEnergy;
        playerUnit.PlayerAbilities = Player.Abilities;
        playerUnit.PlayerPowerups  = Player.Powerups;

        GameObject enemyGO = Instantiate(enemyPrefab, enemyBattleStation);

        enemyUnit           = enemyGO.GetComponent <Unit>();
        enemyUnit.unitName  = "monster" + Player.level;
        enemyUnit.HC        = Player.maxHealth;
        enemyUnit.EC        = Player.maxEnergy;
        enemyUnit.unitLevel = Player.level;
        enemyUnit.currentHP = Player.maxHealth;
        enemyUnit.currentEP = Player.maxEnergy;


        dialogueText.text = "Battle Opponent: " + enemyUnit.unitName + ".";


        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        dialogueText.text = "Battle Begins in .. ";
        yield return(new WaitForSeconds(1f));

        dialogueText.text = "3";
        yield return(new WaitForSeconds(1f));

        dialogueText.text = "2";
        yield return(new WaitForSeconds(1f));

        dialogueText.text = "1";
        yield return(new WaitForSeconds(1f));

        InitializeButtons();

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
Example #17
0
    void InstantiateEnemy()
    {
        var newEnemy = Instantiate(levelStats.enemies[currentEnemy].gameObject, EnemyBattleStation).GetComponent <Unit>();

        if (currentEnemy != 0)
        {
            newEnemy.transform.localPosition = new Vector3(5, 0, 0);
        }
        enemy = newEnemy;
        enemyHUD.SetHUD(enemy);
        enemy.audioOrganizer = audioOrganizer;
        SetDialogueText(player, "A wild " + enemy.unitName + " joined the brawl!", "");
    }
Example #18
0
    // Update is called once per frame
    public virtual IEnumerator SetupBattle()
    {
        //SpawnPlayers();
        //playerPrefab = playerParty.players[0];
        GameObject playerGO = Instantiate(playerPrefab, playerSpace);

        playerUnit = playerGO.GetComponent <Unit>();
        players.Add(playerGO);

        GameObject homie = Instantiate(playerPrefab1, playerSpace1);

        //playerPrefab1 = playerParty.players[1];
        playerUnit1 = homie.GetComponent <Unit>();
        players.Add(homie);
        GameObject homegirl = Instantiate(playerPrefab2, playerSpace2);

        //playerPrefab2 = playerParty.players[2];
        playerUnit2 = homegirl.GetComponent <Unit>();
        players.Add(homegirl);


        GameObject enemyGO = Instantiate(enemyPrefab, enemySpace);

        enemyUnit = enemyGO.GetComponent <Unit>();
        enemies.Add(enemyGO);


        GameObject enemy2 = Instantiate(enemies[0], enemySpace1);

        enemyUnit2 = enemy2.GetComponent <Unit>();

        GameObject enemy3 = Instantiate(enemies[0], enemySpace2);

        enemyUnit2 = enemy2.GetComponent <Unit>();



        dialogueText.text = "A wild " + enemyUnit.unitName + "Approaches";
        playerHUD.SetHUD(playerUnit);
        playerHUD1.SetHUD(playerUnit1);
        playerHUD2.SetHUD(playerUnit2);
        enemyHUD.SetHUD(enemyUnit);
        //enemyHUD1.SetHUD(enemyUnit1);
        //enemyHUD2.SetHUD(enemyUnit2);

        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
        MainCameraView();
    }
Example #19
0
    IEnumerator SetupBossBattle()
    {
        GameObject playerGO = Instantiate(playerPrefab, playerBattleStation);

        playerUnit = playerGO.GetComponent <PlayerUnit>();


        GameObject enemyGO = Instantiate(enemyPrefab, BossBattleStation);

        enemyUnit = enemyGO.GetComponent <EnemyUnit>();

        yield return(new WaitForEndOfFrame());

        playerHUD.SetHUD(playerUnit);

        dialogueText.text = "Defeat the boss!";


        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
Example #20
0
    IEnumerator SetUpBattle()
    {
        state  = BattleStates.Start;
        player = Instantiate(playerPrefab.gameObject, PlayerBattleStation).GetComponent <Unit>();
        playerHUD.SetHUD(player);
        player.audioOrganizer = audioOrganizer;
        InstantiateEnemy();

        if (enemy.type != Unit.EntityType.Boss)
        {
            yield return(new WaitForSeconds(introDialogueWaitTime));
        }
        StartCoroutine(PlayerTurn());
    }
Example #21
0
    /// <summary>
    /// Loads the player hud with all the data from the primary monster.
    /// </summary>
    void LoadPlayerMonsterHud()
    {
        GameObject playerGo = playerInventory.GetMonster();

        playerGo.SetActive(true);
        playerGo.transform.parent        = playerBattleStation;
        playerGo.transform.position      = new Vector3(0.0f, 0.0f);
        playerGo.transform.localPosition = new Vector3(0.0f, 0.0f);
        playerMonster = playerGo.GetComponent <Monster>();
        playerHUD.SetHUD(playerMonster);
        playerMonster.SetSprite();
        playerHUD.SetMovesHUD(playerMonster);
        playerHUD.UpdateUsesHUD(playerMonster);
    }
Example #22
0
    IEnumerator SetupBattle()
    {
        GameObject playerGO = Instantiate(playerPrefab, playerBattleStation);

        playerUnit = playerGO.GetComponent <Unit>();

        GameObject enemyGO = Instantiate(enemyPrefab, enemyBattleStation);

        enemyUnit = enemyGO.GetComponent <Unit>();

        dialogueText.text = "A wild " + enemyUnit.unitName + " approaches...";

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(3f));

        dialogueText.text = enemyUnit.unitName + " appears weakened by your insults!";

        enemyUnit.TakeDamage(playerUnit.damage);

        enemyHUD.SetHP(enemyUnit.currentHP);

        yield return(new WaitForSeconds(2f));

        dialogueText.text = "Your confidence strengthens your level!";

        playerUnit.unitLevel = 999;

        playerHUD.SetHUD(playerUnit);

        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
Example #23
0
    public IEnumerator SetupBattle()
    {
        enemy.GetComponent <AI_Move>().isMoving = false;
        HUD_object.SetActive(true);
        //Get characters into battle
        playerCharacter = player.GetComponent <Character>();
        enemyCharacter  = enemy.GetComponent <Character>();

        enemyHUD.SetHUD(enemyCharacter);
        playerHUD.SetHUD(playerCharacter);
        state = BattleState.PLAYERTURN;
        yield return(new WaitForSeconds(1f));

        PlayerTurn();
    }
Example #24
0
    IEnumerator SetupBattle()
    {
        int getCharacter;

        getCharacter = PlayerPrefs.GetInt(selectedCharacter);

        switch (getCharacter)
        {
        case 1:
            Instantiate(Mage, playerBattleStation);
            playerUnit = Mage.GetComponent <Unit>();
            break;

        case 2:
            Instantiate(Warrior, playerBattleStation);
            playerUnit = Warrior.GetComponent <Unit>();
            break;
        }


        whichEnemy = Random.Range(1, 4);
        if (whichEnemy == 1)
        {
            GameObject enemyGO = Instantiate(enemy1, enemyBattleStation);
            enemyUnit = enemyGO.GetComponent <Unit>();
        }
        if (whichEnemy == 2)
        {
            GameObject enemyGO = Instantiate(enemy2, enemyBattleStation);
            enemyUnit = enemyGO.GetComponent <Unit>();
        }
        if (whichEnemy >= 3)
        {
            GameObject enemyGO = Instantiate(enemy3, enemyBattleStation);
            enemyUnit = enemyGO.GetComponent <Unit>();
        }

        dialogueText.text = "A " + enemyUnit.unitName + " attacks!";

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
Example #25
0
    IEnumerator SetupBattle()
    {
        GameObject playerGO = Instantiate(playerPrefab, playerLocation);

        PlayerUnit = playerGO.GetComponent <Stats>();
        GameObject enemyGO = Instantiate(enemyPrefab, enemyLocation);

        EnemyUnit = enemyGO.GetComponent <Stats>();
        //Retrieves stats about the two
        playerHUD.SetHUD(PlayerUnit);
        enemyHUD.SetHUD(EnemyUnit);

        yield return(new WaitForSeconds(2));

        State = BattleState.PLAYERTURN;
        PlayerTurn();
    }
Example #26
0
    void Awake()
    {
        GameObject playerGO_1 = Instantiate(playerPrefab_1);
        GameObject playerGO_2 = Instantiate(playerPrefab_2);
        GameObject playerGO_3 = Instantiate(playerPrefab_3);

        playerUnit_1 = playerGO_1.GetComponent <Unit>();
        playerUnit_2 = playerGO_2.GetComponent <Unit>();
        playerUnit_3 = playerGO_3.GetComponent <Unit>();
        playerHUD_1.SetHUD(playerUnit_1);
        playerHUD_2.SetHUD(playerUnit_2);
        playerHUD_3.SetHUD(playerUnit_3);

        GameObject enemyGO = Instantiate(enemyPrefab);

        enemyUnit = enemyGO.GetComponent <Unit>();
        enemyHUD.SetHUD(enemyUnit);
    }
    IEnumerator SetupBattle()
    {
        //GameObject playerGO = Instantiate(playerPrefab, playerBattleStation);
        playerUnit = player.GetComponent <Unit>();

        //GameObject enemyGO = Instantiate(enemyPrefab, enemyBattleStation);
        enemyUnit = enemy.GetComponent <Unit>();

        dialogueText.text = "A wild " + enemyUnit.unitName + " approaches...";

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
    IEnumerator SetupBattle()
    {
        playerGO   = Instantiate(playerPrefab, playerBattleStation);
        playerUnit = playerGO.GetComponent <Unit>();

        enemyGO   = Instantiate(enemyPrefab, enemyBattleStation);
        enemyUnit = enemyGO.GetComponent <Unit>();

        dialogueText.text = "Defeat " + enemyUnit.unitName;

        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }
Example #29
0
    IEnumerator SetupBattle()
    {
        GameObject playerGo = Instantiate(player, playerLocation);
        GameObject enemyGo  = Instantiate(enemy, enemyLocation);

        playerUnit = playerGo.GetComponent <Unit>();
        enemyUnit  = enemyGo.GetComponent <Unit>();

        dialogueText.text = "A wild " + enemyUnit.unitName + " appeared!";
        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);
        playerUnit.ensureStats();
        enemyUnit.ensureStats();
        yield return(new WaitForSeconds(3f));

        state = BattleState.MIDDLE;
        Middle();
    }
Example #30
0
    IEnumerator SetupBattle()
    {
        // Instantiating the prefab and locataion for player character 1


        Vector3    player1pos = player1Spawn.transform.position;
        Quaternion player1rot = player1Spawn.transform.rotation;
        GameObject player1GO  = Instantiate(Resources.Load("cloud_prefab") as GameObject);

        player1GO.transform.position = player1pos;
        player1GO.transform.rotation = player1rot;
        playerUnit = player1GO.GetComponent <Unit>();

        // Instantiating the prefab and locataion for player character 2
        Vector3    player2pos = player2Spawn.transform.position;
        Quaternion player2rot = player2Spawn.transform.rotation;
        GameObject player2GO  = Instantiate(Resources.Load("tifa_prefab") as GameObject);

        player2GO.transform.position = player2pos;
        player2GO.transform.rotation = player2rot;
        // CREATE UNIT REF HERE



        // Instantiating the prefab and locataion for enemy character 1
        Vector3    enemy1pos = enemy1Spawn.transform.position;
        Quaternion enemy1rot = enemy1Spawn.transform.rotation;
        GameObject enemy1GO  = Instantiate(Resources.Load("sephiroth_prefab") as GameObject);

        enemy1GO.transform.position = enemy1pos;
        enemy1GO.transform.rotation = enemy1rot;
        enemyUnit = enemy1GO.GetComponent <Unit>();
        // CREATE UNIT REF HERE



        playerHUD.SetHUD(playerUnit);
        enemyHUD.SetHUD(enemyUnit);

        yield return(new WaitForSeconds(2f));

        state = BattleState.PLAYERTURN;
        PlayerTurn();
    }