Exemplo n.º 1
0
        public PowerUp GetPowerup(string powerupType)
        {
            if (powerupType == null)
            {
                return(null);
            }

            if (powerupType.Equals("DeflectionSyringe"))
            {
                PowerupFlyweight flyweight = PowerupFlyweightFactory.GetFlyweight(TextureIdentifier.DeflectionSyringe, new DeflectionStrategy());
                return(new DeflectionSyringe(flyweight));
            }
            else if (powerupType.Equals("HealingSyringe"))
            {
                PowerupFlyweight flyweight = PowerupFlyweightFactory.GetFlyweight(TextureIdentifier.HealingSyringe, new HealingStrategy());
                return(new HealingSyringe(flyweight));
            }
            else if (powerupType.Equals("Medkit"))
            {
                PowerupFlyweight flyweight = PowerupFlyweightFactory.GetFlyweight(TextureIdentifier.Medkit, new HealingStrategy());
                var tmpMedkit = new Medkit(flyweight);

                tmpMedkit.PowerUpStrategy = new HealingStrategy(100f);

                return(tmpMedkit);
            }
            else if (powerupType.Equals("MovementSyringe"))
            {
                PowerupFlyweight flyweight = PowerupFlyweightFactory.GetFlyweight(TextureIdentifier.MovementSyringe, new MovmentSpeedStrategy());
                return(new MovementSyringe(flyweight));
            }
            else if (powerupType.Equals("ReloadSyringe"))
            {
                PowerupFlyweight flyweight = PowerupFlyweightFactory.GetFlyweight(TextureIdentifier.ReloadSyringe, new ReloadSpeedStrategy());
                return(new ReloadSyringe(flyweight));
            }
            return(null);
        }
Exemplo n.º 2
0
 public ReloadSyringe(PowerupFlyweight flyweight) : base(flyweight)
 {
 }
Exemplo n.º 3
0
 public PowerUp(PowerupFlyweight powerupFlyweight)
 {
     this.Texture         = powerupFlyweight.Texture;
     this.PowerUpStrategy = powerupFlyweight.Strategy;
 }
Exemplo n.º 4
0
 public Medkit(PowerupFlyweight powerupFlyweight) : base(powerupFlyweight)
 {
 }
Exemplo n.º 5
0
 public HealingSyringe(PowerupFlyweight powerupFlyweight) : base(powerupFlyweight)
 {
 }
Exemplo n.º 6
0
 public MovementSyringe(PowerupFlyweight powerupFlyweight) : base(powerupFlyweight)
 {
 }
Exemplo n.º 7
0
 public DeflectionSyringe(PowerupFlyweight flyweight) : base(flyweight)
 {
 }