コード例 #1
0
    void ParseFlagsRoundBonusPicking()
    {
        if (global.RoundBonusFlag != RoundBonusManager.RoundBonusType.NOTHING)
        {
            //Tell other players so they can react to you picking. New and old bonus sent so old one can be put back into the pool.
            localPlayer.localPlayerObject.GetComponent <TakenTurnData>().SendRoundBonusPicked(global.RoundBonusFlag);

            //In case the player is picking a new bonus instead of his first one
            if (localPlayer.CurrentRoundBonus != null)
            {
                localPlayer.localPlayerObject.GetComponent <TakenTurnData>().SendRoundBonusReturned(localPlayer.CurrentRoundBonus.Type);

                //take away the bonus given from this rounds chosen bonus.
                localPlayer.AddToNonBuildingIncome(localPlayer.CurrentRoundBonus.Round_Income.Reciprocal().IncomeAsArray());
                RemoveRoundBonusAbilities();
                roundEndBonusManager.ResetBonuses();
            }

            //give player bonus income
            if (roundBonusManager.GetRoundBonus(global.RoundBonusFlag).Round_Income != null)
            {
                localPlayer.CurrentRoundBonus = roundBonusManager.GetRoundBonus(global.RoundBonusFlag);
                localPlayer.AddToNonBuildingIncome(roundBonusManager.GetRoundBonus(global.RoundBonusFlag).Round_Income.IncomeAsArray());
            }

            //If there's a point bonus
            if (roundBonusManager.GetRoundBonus(global.RoundBonusFlag).RoundPointbonus != null)
            {
                localPlayer.AddPointBonus(roundBonusManager.GetRoundBonus(global.RoundBonusFlag).RoundPointbonus, true); //It will sort itself out at the end since it's temporary
            }

            //Special round bonuses require abilities to be added
            if (global.RoundBonusFlag == RoundBonusManager.RoundBonusType.OneTerraform_TwoGold)
            {
                am.AddAbility <AbilityTerraform1>();
            }
            if (global.RoundBonusFlag == RoundBonusManager.RoundBonusType.OneCult_FourGold)
            {
                am.AddAbility <AbilityAddToCult>();
            }

            networkedUI.DisEnableRoundBonuses(false); //Then take them off the screen

            RetirePlayer();
            global.ResetFlags();
        }
    }