Beispiel #1
0
    public void SetPlayerBuff(STR_CurrentPlayerBuffs mCurrentBuffs)
    {
        currentPlayerBuffs = mCurrentBuffs;
        healthMultiplier   = 1.0f;
        reloadMultiplier   = 1.0f;
        costMultiplier     = 1.0f;
        speedMultipler     = 1.0f;

        switch (mCurrentBuffs.PositiveBuff.typeOfBuff)
        {
        case BuffType.Health: healthMultiplier = mCurrentBuffs.PositiveBuff.abilityAffectValue; break;

        case BuffType.Cost: costMultiplier = mCurrentBuffs.PositiveBuff.abilityAffectValue; break;

        case BuffType.Reload: reloadMultiplier = mCurrentBuffs.PositiveBuff.abilityAffectValue; break;

        case BuffType.Speed: speedMultipler = mCurrentBuffs.PositiveBuff.abilityAffectValue; break;
        }


        switch (mCurrentBuffs.NegativeBuff.typeOfBuff)
        {
        case BuffType.Health: healthMultiplier = mCurrentBuffs.NegativeBuff.abilityAffectValue; break;

        case BuffType.Cost: costMultiplier = mCurrentBuffs.NegativeBuff.abilityAffectValue; break;

        case BuffType.Reload: reloadMultiplier = mCurrentBuffs.NegativeBuff.abilityAffectValue; break;

        case BuffType.Speed: speedMultipler = mCurrentBuffs.NegativeBuff.abilityAffectValue; break;
        }

        GetComponent <SCR_PlayerInput>().SpeedMultiplier   = speedMultipler;
        GetComponent <SCR_PlayerHealth>().HealthMultiplier = healthMultiplier;
    }
    private STR_CurrentPlayerBuffs DeterminePlayerBuffs()
    {
        bool selected = false;

        STR_CurrentPlayerBuffs currentPlayerBuffs = new STR_CurrentPlayerBuffs();
        SCR_BuffType           selectedBuff       = new SCR_BuffType();

        currentPlayerBuffs.PositiveBuff = selectedBuff;

        while (!selected)
        {
            int rng = Random.Range(0, ListOfBuffs.Length);
            selectedBuff = ListOfBuffs[rng];
            if (selectedBuff.positiveBuff == true)
            {
                selected = true;
                currentPlayerBuffs.PositiveBuff = selectedBuff;
            }
        }

        selected = false;

        while (!selected)
        {
            int rng = Random.Range(0, ListOfBuffs.Length);
            selectedBuff = ListOfBuffs[rng];
            if (selectedBuff.positiveBuff == false && (selectedBuff.typeOfBuff != currentPlayerBuffs.PositiveBuff.typeOfBuff))
            {
                selected = true;
                currentPlayerBuffs.NegativeBuff = selectedBuff;
            }
        }

        return(currentPlayerBuffs);
    }
    /// <summary>
    /// Called by the main menu manager before it destroys itself. The buffs that were determined at the main menu are passed in and assigned.
    /// </summary>
    /// <param name="mPlayer1Buffs"></param>
    /// <param name="mPlayer2Buffs"></param>
    public void SetPlayerBuffs(STR_CurrentPlayerBuffs mPlayer1Buffs, STR_CurrentPlayerBuffs mPlayer2Buffs)
    {
        player1Inventory = GameObject.FindGameObjectWithTag("Player1").GetComponent <SCR_CharacterInventory>();
        player2Inventory = GameObject.FindGameObjectWithTag("Player2").GetComponent <SCR_CharacterInventory>();

        player1Buffs = mPlayer1Buffs;
        player2Buffs = mPlayer2Buffs;

        if (player1Inventory)
        {
            player1Inventory.SetPlayerBuff(mPlayer1Buffs);
        }

        if (player2Inventory)
        {
            player2Inventory.SetPlayerBuff(mPlayer2Buffs);
        }
    }
 public void AssignPlayerBuffs()
 {
     player1Buffs = DeterminePlayerBuffs();
     player2Buffs = DeterminePlayerBuffs();
 }