コード例 #1
0
        public bool PerformCurrencyTransaction(IPerformsCurrencyTransaction player)
        {
            //For now we do not have a max limit to how much currency we can have.
            //So this will always return true.

            player.CollectCurrency(CurrencyValue);
            Destroy();

            return(true);
        }
コード例 #2
0
ファイル: SafeZone.cs プロジェクト: vchelaru/Anfloga
        public bool PerformCurrencyTransaction(IPerformsCurrencyTransaction player)
        {
            bool toReturn = false;

            //If the player has enough currency, then we will activate this safe zone.
            if (player.CurrentCurrencyBalance >= ActivationCost)
            {
                toReturn = true;
                PerformActivation();
                player.SpendCurrency(ActivationCost);
                BuiltByPlayer = true;
                var thePlayer = player as Player;

                // magic number so the player spawns a bit above the bottom of the safe zone
                float yPositionJustAbovePolygonBottom = this.Y + SpriteInstance.RelativeY + 20;
                thePlayer.UpdateLastCheckpointPosition(this.X, yPositionJustAbovePolygonBottom);
            }

            return(toReturn);
        }