コード例 #1
0
ファイル: Tower.cs プロジェクト: quajak/TowerDefenseGame
        public IceTower(float x, float y, bool buy = false) : base(x, y, new CircleShape(10f), _cost, "Ice Tower", "Slows down enemies in range by 50%", 150f, -40, 600f)
        {
            if (buy)
            {
                Program.Money -= Cost;
            }
            shape.Texture = new Texture("./Resources/IceTower.png");
            Upgrade rangeI = new Upgrade(new Modifier(ModifierType.Percentage, 30), 5, "Range I", "Area of effect increases by 30%", UpdateType.Range)
            {
                Unlocks =
                {
                    new Upgrade(new Modifier(ModifierType.Percentage, 30), 7, "Range II", "Area of effect increases by 30%", UpdateType.Range)
                }
            };
            Upgrade damageI = new CustomUpgrade(null, 3, "Ice snap", "Will attack enemies in its range", t => (t as IceTower).Damage += 1)
            {
                Unlocks =
                {
                    new CustomUpgrade(new Modifier(ModifierType.Percentage,   -10),              5, "Ice snap II",                "Deals additional 2 damage", t => (t as IceTower).Damage += 2)
                    {
                        Unlocks =
                        {
                            new CustomUpgrade(null,                                                       20, "Ice snap III", "Deals additional 10 damage", t => (t as IceTower).Damage += 10),
                            new Upgrade(new Modifier(ModifierType.Percentage,                           -66),             25, "Turbo Speed",                "Attacks very quick",        UpdateType.Speed)
                        }
                    }
                }
            };

            AvailableUpgrades.Add(damageI);
            AvailableUpgrades.Add(rangeI);
        }
コード例 #2
0
ファイル: Cannon.cs プロジェクト: quajak/TowerDefenseGame
        public Cannon(float x, float y, bool buy = false) : base(x, y, new RectangleShape(new Vector2f(20, 20)), _cost, "Cannon", "Shoot bullets which explode",
                                                                 200, 2, 500)
        {
            if (buy)
            {
                Program.Money -= _cost;
            }
            shape.Texture  = new Texture("./Resources/cannon.png");
            shape.Origin   = new Vector2f(10, 10);
            position       = new Vector2f(position.X + 10, position.Y + 10);
            shape.Position = position;
            CustomUpgrade pierce = new CustomUpgrade(null, 5, "Pierce I", "Each shell has 1 more pierce", (t) => (t as Cannon).ExtraPierce += 1)
            {
                Unlocks =
                {
                    new CustomUpgrade(null,         12, "Pierce II",  "Each shell has 2 more pierce", (t) => (t as Cannon).ExtraPierce += 2)
                    {
                        Unlocks =
                        {
                            new CustomUpgrade(null, 20, "Pierce III", "Each shell has 3 more pierce", (t) => (t as Cannon).ExtraPierce += 3)
                        }
                    }
                }
            };
            CustomUpgrade explosionSize = new CustomUpgrade(null, 4, "Explosions I", "Exposions are 50% stronger",
                                                            t => (t as Cannon).ExplosionSize.modifiers.Add(new Modifier(ModifierType.Percentage, 50)))
            {
                Unlocks =
                {
                    new CustomUpgrade(null, 4, "Explosions II", "Exposions deal 3 more damage",
                                      t => (t as Cannon).ExplosionDamage += 3)
                }
            };
            Upgrade rangeI = new Upgrade(new Modifier(ModifierType.Value, 50), 8, "Further I", "Increases range by 50", UpdateType.Range)
            {
                Unlocks =
                {
                    new Upgrade(new Modifier(ModifierType.Value,          50),  6, "Further II",  "Increases range by 50", UpdateType.Range)
                    {
                        Unlocks =
                        {
                            new Upgrade(new Modifier(ModifierType.Value, 100), 15, "Further III", "Increases range by 100", UpdateType.Range)
                        }
                    }
                }
            };

            AvailableUpgrades.Add(pierce);
            AvailableUpgrades.Add(explosionSize);
            AvailableUpgrades.Add(rangeI);
        }
コード例 #3
0
ファイル: ResourceUpgrader.cs プロジェクト: won21kr/Warewolf
 public XElement UpgradeResource(XElement sourceVersion, Version destinationVersion, Action<XElement> onUpgrade)
 {
     var available = AvailableUpgrades.Where(a => a.CanUpgrade(sourceVersion)).OrderBy(a=>a.UpgradesFrom).Select(a=>a.Upgrade.UpgradeFunc).ToList();
     if (available.Any())
     {
         var outputLang = available.Aggregate((a, b) => (x => b(a(x))));
         
         var output =  outputLang(sourceVersion);
         output.SetAttributeValue("ServerVersion",GetVersion());
         onUpgrade(output);
         return output;
     }
   
     return sourceVersion;
 }
コード例 #4
0
ファイル: Tower.cs プロジェクト: quajak/TowerDefenseGame
        public LazorGun(int aX, int aY, bool buy = false) : base(aX, aY, new RectangleShape(new Vector2f(20, 20)), _cost, "Lazor Gun", "Shoots lazors", 400f, 0f, 2_500f)
        {
            renderLayer = 100; // Cheap hack so that the lazor is below the tower
            if (buy)
            {
                Program.Money -= Cost;
            }
            shape.Origin   = new Vector2f(10, 10);
            shape.Texture  = new Texture("./Resources/LazorGun.png");
            position       = new Vector2f(position.X + 10, position.Y + 10);
            shape.Position = position;
            Upgrade rangeI = new Upgrade(new Modifier(ModifierType.Value, 100), 5, "Further I", "Increases range by 100", UpdateType.Range)
            {
                Unlocks =
                {
                    new Upgrade(new Modifier(ModifierType.Percentage,     20),  7, "Further II",  "Increases range by 20%", UpdateType.Range)
                    {
                        Unlocks =
                        {
                            new Upgrade(new Modifier(ModifierType.Value, 600), 15, "Further III", "Shoots as far as you can see!", UpdateType.Range)
                        }
                    }
                }
            };
            Upgrade speedI = new Upgrade(new Modifier(ModifierType.Percentage, -20), 5, "Faster I", "Shoots 20% quicker.", UpdateType.Speed)
            {
                Unlocks =
                {
                    new Upgrade(new Modifier(ModifierType.Percentage,         -20), 10, "Faster II",  "Shoots 20% quicker.", UpdateType.Speed)
                    {
                        Unlocks =
                        {
                            new Upgrade(new Modifier(ModifierType.Percentage, -20), 13, "Faster III", "Shoots 20% quicker.", UpdateType.Speed)
                        }
                    }
                }
            };

            AvailableUpgrades.Add(rangeI);
            AvailableUpgrades.Add(speedI);
        }
コード例 #5
0
ファイル: Tower.cs プロジェクト: quajak/TowerDefenseGame
        public MachineGun(int aX, int aY, bool buy = false) : base(aX, aY, new RectangleShape(new Vector2f(20, 20)), _cost, "Machine Gun",
                                                                   "Shoots bullets very quickly", 200f, 1f, 150f)
        {
            shape.Origin   = new Vector2f(10, 10);
            position       = new Vector2f(position.X + 10, position.Y + 10);
            shape.Position = position;
            if (buy)
            {
                Program.Money -= Cost;
            }
            shape.Texture = new Texture("./Resources/MachineGun.png");
            Upgrade pierceI = new Upgrade(new Modifier(ModifierType.Value, 1), 3, "Damage I", "Bullets do 1 damage more", UpdateType.Amount)
            {
                Unlocks =
                {
                    new Upgrade(new Modifier(ModifierType.Value,                 1),  5, "Damage II",  "Bullets do 1 damage more", UpdateType.Amount)
                    {
                        Unlocks =
                        {
                            new Upgrade(new Modifier(ModifierType.Value,                 1),  7, "Damage III", "Bullets do 1 damage more", UpdateType.Amount)
                            {
                                Unlocks =
                                {
                                    new Upgrade(new Modifier(ModifierType.Value,         3), 10, "Damage IV", "Bullets 3 damage more", UpdateType.Amount)
                                }
                            }
                        }
                    }
                }
            };
            Upgrade rangeI = new Upgrade(new Modifier(ModifierType.Value, 25), 5, "Further I", "Increases range by 25", UpdateType.Range)
            {
                Unlocks =
                {
                    new Upgrade(new Modifier(ModifierType.Value,          50),  6, "Further II",  "Increases range by 50", UpdateType.Range)
                    {
                        Unlocks =
                        {
                            new Upgrade(new Modifier(ModifierType.Value, 100), 15, "Further III", "Increases range by 100", UpdateType.Range)
                        }
                    }
                }
            };
            Upgrade speedI = new Upgrade(new Modifier(ModifierType.Value, -30), 2, "Faster I", "Shoots bullets 20% quicker", UpdateType.Speed)
            {
                Unlocks =
                {
                    new Upgrade(new Modifier(ModifierType.Value,            -30),  2, "Faster II",  "Shoots bullets 25% quicker", UpdateType.Speed)
                    {
                        Unlocks =
                        {
                            new Upgrade(new Modifier(ModifierType.Absolute,  50), 10, "Super Fast", "Shoots 20 bullets a second", UpdateType.Speed)
                        }
                    }
                }
            };

            AvailableUpgrades.Add(pierceI);
            AvailableUpgrades.Add(rangeI);
            AvailableUpgrades.Add(speedI);
            AvailableUpgrades.Add(new CustomUpgrade(null, 5, "Bigger bullets", "The bullets are bigger", (tower) => (tower as MachineGun).BulletSize += 0.5f));
        }