Example #1
0
        //////////Methods//////////

        /// <summary>
        /// Creates a new powerup
        /// </summary>
        public Powerup(Pirates.Powerup powerup, int currentTurn)
        {
            this.nativeObject = powerup;

            this.Id               = powerup.Id;
            this.Location         = new Location(powerup.Location);
            this.ActiveTurns      = powerup.ActiveTurns;
            this.Type             = powerup.Type;
            this.TurnsToDisappear = powerup.EndTurn - currentTurn;
        }
Example #2
0
        //////////Static Methods//////////

        /// <summary>
        /// Gets the powerup object, based on the parameters given
        /// </summary>
        public static Powerup GetPowerup(Pirates.Powerup powerup, int curTurn)
        {
            if (powerup == null)
            {
                return(null);
            }
            else if (powerup is Pirates.AttackPowerup)
            {
                return(new AttackPowerup(powerup as Pirates.AttackPowerup, curTurn));
            }
            else if (powerup is Pirates.SpeedPowerup)
            {
                return(new SpeedPowerup(powerup as Pirates.SpeedPowerup, curTurn));
            }
            else
            {
                return(null);
            }
        }