Esempio n. 1
0
    public void killEnemy(GameObject enemyToKill)
    {
        SpanEnemies enemyToKill_properties = enemyToKill.GetComponent <SpanEnemies>();
        int         enemyToKill_speed      = (int)enemy_properties.getEnemy(enemyChosenIndex).GetComponent <BattleEnemy>().getEnemySpeed();

        /////////////
        // Get EXP //
        /////////////
        int enemyToKill_exp = enemy_properties.getEnemy(enemyChosenIndex).GetComponent <BattleEnemy>().getExpDroped();

        player_properties.gainExp(enemyToKill_exp);
        battle_exp += enemyToKill_exp;

        ///////////////////////////////////////
        // Remove enemy and reset turn queue //
        ///////////////////////////////////////
        enemy_properties.removeEnemy(enemyChosenIndex);
        turnQueue = new GameObject[enemy_properties.getSize() + 1];
        turnQueueLength--;

        /////////////////////////////////////////////////////////////////
        // This is done if the enemy's speed is high than the player's //
        /////////////////////////////////////////////////////////////////
        if (enemyToKill_speed > player_properties.getPlayerSpeed())
        {
            turnIndex--;
        }
        initTurnQueue();
        Destroy(enemyToKill);
    }
Esempio n. 2
0
    void Start()
    {
        //gameManager_properties.printInventory();

        // *** INITIALIZING PLAYER OBJECT ***
        player_properties = player.GetComponent <BattleChar>();

        // *** INITIALIZING ENEMY OBJECT[S]***
        enemy_properties = enemy.GetComponent <SpanEnemies>();

        // *** INITIALIZING UI OBJECTS[S]***
        UI_properties = UIController.GetComponent <UIController>();



        // *** THIS IS THE LOCATION OF THE PLAYER'S NAME... ***
        // *** WILL NEED SOMETHING FOR OTHER PARTY MEMBERS... ***
        //playerName = UIController.GetComponent<UIController>().charName;
        playerName = UI_properties.charName;

        // *** THIS IS USED THE MOVE FUNCTION ***
        // *** WILL PROBABLY NEED ONE FOR EACH PARTY MEMEBER ***
        player_original_position = player.transform.position;

        // *** THIS INDEX IS USED FOR WHAT BUTTON THE CURSOR SHOULD MOVE TO ***
        buttonSelectIndex = 0;

        // *** THIS FUNCTION WILL SPAWN BETWEEN 1-3 ENEMIES FOR THE PLAYER TO FIGHT ***
        enemy_properties.Spawn();

        /// **** THIS INITIALIZES THE 'TURN QUEUE' BASED ON THE SPEED OF THE GAME OBJECT ****

        /* ***HOW THIS FUNCTION WORKS***
         * initTurnQueue creates an array of game objects...
         * It sorts each object by their speed stat.
         * Fastest first, slowest last.
         */
        initTurnQueue();

        // *** THIS GETS THE LENGTH OF THE 'TURN QUEUE'... IT SHOULD PROBABLY BE IT'S OWN FUNCTION... ***
        for (int i = 0; i < turnQueue.Length; i++)
        {
            if (turnQueue[i] != null)
            {
                turnQueueLength++;
            }
        }

        // ***THIS CODE BLOCK FIGURES OUT WHO GOES FIRST***
        if (turnQueue[0].name == "Final_Jerry_Battle")
        {
            state = BattleState.PLAYERPARTYTURNSTART;
        }
        else
        {
            state = BattleState.ENEMYPARTYTURN;
        }
        // ***THIS IS FOR THE DAMAGE NUMBERS THAT POP-UP***
        floating_damage_number = damageDisplayer.GetComponent <DamageSpawner>();
    }
Esempio n. 3
0
    private Vector3[] initEnemyArray()
    {
        // ***ESSENTIALLY DOES THE SAME THING AS ABOVE EXCEPT WITH ENEMIES***
        int         enemy_amount = enemy.GetComponent <SpanEnemies>().getSize();
        SpanEnemies enemy_x      = enemy.GetComponent <SpanEnemies>();

        Vector3[] enemyPosArr = new Vector3[enemy_amount];
        for (int i = 0; i < enemy_amount; i++)
        {
            enemyPosArr[i] = enemy_x.getEnemy(i).transform.position;
        }
        return(enemyPosArr);
    }