コード例 #1
0
        public Main(ManagerUnits managerUnits, ManagerBuildings managerBuildings, ManagerMouse managerMouse)
        {
            this.managerUnits     = managerUnits;
            this.managerMouse     = managerMouse;
            this.managerBuildings = managerBuildings;

            managerMouse.MouseEventHandler += ManagerMouse_MouseEventHandler;
        }
コード例 #2
0
        public Miner(ManagerBuildings managerBuildings, Unit worker)
        {
            goldMine = managerBuildings.buildings.Find((b) => (b.information as InformationBuilding).Type == Util.Buildings.GOLD_MINE) as GoldMine;
            townHall = managerBuildings.buildings.Find((b) => (b.information as InformationBuilding).Type == Util.Buildings.TOWN_HALL) as TownHall;

            this.worker           = worker;
            this.managerBuildings = managerBuildings;
        }
コード例 #3
0
        public BuilderWalls(Peasant peasant, ManagerMouse managerMouse, ManagerBuildings managerBuildings, ManagerUnits managerUnits)
        {
            this.peasant          = peasant;
            this.managerMouse     = managerMouse;
            this.managerBuildings = managerBuildings;
            this.managerUnits     = managerUnits;

            managerMouse.MouseEventHandler += ManagerMouse_MouseEventHandler;
        }
コード例 #4
0
        public BuilderWalls(Builder builder, ManagerMouse managerMouse, ManagerBuildings managerBuildings, ManagerUnits managerUnits)
        {
            this.builder          = builder;
            this.managerMouse     = managerMouse;
            this.managerBuildings = managerBuildings;
            this.managerUnits     = managerUnits;

            managerMouse.MouseEventHandler += ManagerMouse_MouseEventHandler;
        }
コード例 #5
0
        public Main(ManagerUnits managerUnits, ManagerBuildings managerBuildings, ManagerMouse managerMouse, List <ManagerEnemies> managerEnemies)
        {
            this.managerUnits     = managerUnits;
            this.managerMouse     = managerMouse;
            this.managerBuildings = managerBuildings;
            this.managerEnemies   = managerEnemies;

            managerMouse.MouseEventHandler += ManagerMouse_MouseEventHandler;
        }
コード例 #6
0
        public BuilderBuildings(Util.Buildings building, Unit builder, ManagerMouse managerMouse, ManagerBuildings managerBuildings, ManagerUnits managerUnits)
        {
            this.builder = builder;

            this.managerMouse     = managerMouse;
            this.managerUnits     = managerUnits;
            this.managerBuildings = managerBuildings;

            this.building = Buildings.Building.Factory(building, managerMouse, managerBuildings.managerMap, managerUnits);
        }
コード例 #7
0
        protected override void Initialize()
        {
            managerBuildings = new ManagerBuildings(managerMouse, managerMap);
            managerEnemies   = new ManagerEnemies(managerMouse, managerMap, managerBuildings);
            managerUnits     = new ManagerUnits(managerMouse, managerMap, managerBuildings, managerEnemies);
            managerUI        = new ManagerUI(managerMouse, managerBuildings, managerUnits);

            managerCombat = new ManagerCombat(managerUnits, managerEnemies, managerBuildings);

            camera = new Camera(GraphicsDevice.Viewport);

            base.Initialize();
        }
コード例 #8
0
        public override void Initializer()
        {
            ManagerResources.PLAYER_FOOD = 5;

            managerIsland = new ManagerIsland(managerMouse);

            managerEnemies = new ManagerEnemies(managerMouse, managerIsland.CurrentMap(), 0);

            managerPlayerBuildings = new ManagerPlayerBuildings(managerMouse, managerIsland.CurrentMap());
            managerPlayerUnits     = new ManagerPlayerUnits(managerMouse, managerIsland.CurrentMap(), managerPlayerBuildings, managerEnemies);

            managerUI     = new ManagerUI(managerMouse, managerPlayerBuildings, managerPlayerUnits, null);
            managerCombat = new ManagerCombat(managerEnemies, managerPlayerUnits, managerPlayerBuildings);

            increment       = 0.1f;
            fadeOut         = 0;
            showSummary     = false;
            Battleship.move = false;

            Warcraft.camera.Start();
        }
コード例 #9
0
ファイル: Peon.cs プロジェクト: yufeixuan/warcraft
        public Peon(int tileX, int tileY, ManagerMouse managerMouse, ManagerMap managerMap, ManagerUnits managerUnits, ManagerBuildings managerBuildings)
            : base(tileX, tileY, managerMouse, managerMap, managerUnits)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            // UP
            spriteWalking.Add(new Sprite(14, 2, 29, 32));
            spriteWalking.Add(new Sprite(17, 40, 24, 24));
            spriteWalking.Add(new Sprite(17, 82, 25, 33));
            spriteWalking.Add(new Sprite(12, 122, 31, 33));
            spriteWalking.Add(new Sprite(13, 164, 28, 33));
            // DOWN
            spriteWalking.Add(new Sprite(209, 6, 30, 25));
            spriteWalking.Add(new Sprite(210, 46, 25, 29));
            spriteWalking.Add(new Sprite(210, 87, 26, 28));
            spriteWalking.Add(new Sprite(210, 128, 31, 29));
            spriteWalking.Add(new Sprite(211, 169, 30, 28));
            // LEFT
            spriteWalking.Add(new Sprite(122, 1, 18, 33));
            spriteWalking.Add(new Sprite(118, 40, 28, 31));
            spriteWalking.Add(new Sprite(119, 81, 24, 32));
            spriteWalking.Add(new Sprite(119, 121, 28, 32));
            spriteWalking.Add(new Sprite(118, 163, 22, 34));
            // UP-RIGHT
            spriteWalking.Add(new Sprite(69, 0, 26, 34));
            spriteWalking.Add(new Sprite(68, 39, 26, 31));
            spriteWalking.Add(new Sprite(68, 80, 25, 31));
            spriteWalking.Add(new Sprite(63, 121, 37, 36));
            spriteWalking.Add(new Sprite(67, 162, 29, 36));
            // DOWN-RIGHT
            spriteWalking.Add(new Sprite(164, 2, 23, 29));
            spriteWalking.Add(new Sprite(159, 41, 33, 32));
            spriteWalking.Add(new Sprite(161, 83, 31, 31));
            spriteWalking.Add(new Sprite(164, 122, 25, 30));
            spriteWalking.Add(new Sprite(162, 165, 25, 27));

            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteGold = new List <Sprite>();

            // MINER UP
            spriteGold.Add(new Sprite(36, 536, 27, 34));
            spriteGold.Add(new Sprite(37, 575, 26, 36));
            spriteGold.Add(new Sprite(37, 620, 27, 35));
            spriteGold.Add(new Sprite(35, 662, 27, 35));
            spriteGold.Add(new Sprite(34, 706, 28, 35));
            // MINER DOWN
            spriteGold.Add(new Sprite(180, 534, 30, 34));
            spriteGold.Add(new Sprite(180, 575, 29, 38));
            spriteGold.Add(new Sprite(180, 619, 29, 37));
            spriteGold.Add(new Sprite(181, 662, 29, 38));
            spriteGold.Add(new Sprite(181, 705, 29, 37));
            // MINER RIGHT
            spriteGold.Add(new Sprite(109, 539, 25, 32));
            spriteGold.Add(new Sprite(109, 579, 26, 30));
            spriteGold.Add(new Sprite(110, 623, 25, 32));
            spriteGold.Add(new Sprite(110, 665, 24, 31));
            spriteGold.Add(new Sprite(109, 709, 25, 30));
            // MINER UP RIGHT
            spriteGold.Add(new Sprite(75, 537, 24, 34));
            spriteGold.Add(new Sprite(72, 577, 27, 31));
            spriteGold.Add(new Sprite(72, 621, 27, 32));
            spriteGold.Add(new Sprite(77, 664, 22, 36));
            spriteGold.Add(new Sprite(77, 707, 22, 36));
            // MINER DOWN RIGHT
            spriteGold.Add(new Sprite(142, 539, 28, 28));
            spriteGold.Add(new Sprite(143, 579, 29, 32));
            spriteGold.Add(new Sprite(144, 624, 29, 31));
            spriteGold.Add(new Sprite(144, 665, 29, 29));
            spriteGold.Add(new Sprite(144, 710, 28, 26));
            sprites.Add(AnimationType.GOLD, spriteGold);

            List <Sprite> spriteDie = new List <Sprite>();

            spriteDie.Add(new Sprite(13, 494, 34, 32));
            sprites.Add(AnimationType.DYING, spriteDie);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            animations.Add("up", new Frame(0, 5));
            animations.Add("down", new Frame(5, 5));
            animations.Add("right", new Frame(10, 5));
            animations.Add("left", new Frame(10, 5, true));
            animations.Add("upRight", new Frame(15, 5));
            animations.Add("downRight", new Frame(20, 5));
            animations.Add("upLeft", new Frame(15, 5, true));
            animations.Add("downLeft", new Frame(20, 5, true));
            animations.Add("dying", new Frame(0, 1));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.Builder(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Orcs/Peon");
            textureName.Add(AnimationType.GOLD, "Orcs/Peon");
            textureName.Add(AnimationType.DYING, "Orcs/Peon");

            information = new InformationUnit("Peon", Race.ORC, Faction.HORDE, 30, 0, 4, 10, 400, 1, Util.Buildings.GREAT_HALL, 45 * Warcraft.FPS, 3, 1, Util.Units.PEON, 2);
            Information = information;

            commands.Add(new BuilderBuildings(Util.Buildings.GREAT_HALL, this, managerMouse, managerBuildings, managerUnits));
            commands.Add(new BuilderBuildings(Util.Buildings.ORC_BARRACKS, this, managerMouse, managerBuildings, managerUnits));
            commands.Add(new BuilderBuildings(Util.Buildings.PIG_FARM, this, managerMouse, managerBuildings, managerUnits));
            commands.Add(new BuilderWalls(this, managerMouse, managerBuildings, managerUnits));
            commands.Add(new Miner(managerBuildings, managerUnits, this));
            commands.Add(new BuilderBuildings(Util.Buildings.ALTAR_OF_STORMS, this, managerMouse, managerBuildings, managerUnits));
        }
コード例 #10
0
ファイル: Knight.cs プロジェクト: yufeixuan/warcraft
        public Knight(int tileX, int tileY, ManagerMouse managerMouse, ManagerMap managerMap, ManagerUnits managerUnits, ManagerBuildings managerBuildings)
            : base(tileX, tileY, 64, 64, 1, managerMouse, managerMap, managerUnits)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            // UP
            spriteWalking.Add(new Sprite(24, 9, 34, 64));
            spriteWalking.Add(new Sprite(21, 83, 37, 64));
            spriteWalking.Add(new Sprite(18, 157, 40, 62));
            spriteWalking.Add(new Sprite(21, 233, 37, 62));
            spriteWalking.Add(new Sprite(24, 305, 34, 64));
            // DOWN
            spriteWalking.Add(new Sprite(318, 18, 34, 49));
            spriteWalking.Add(new Sprite(318, 92, 34, 48));
            spriteWalking.Add(new Sprite(318, 164, 34, 49));
            spriteWalking.Add(new Sprite(317, 238, 35, 57));
            spriteWalking.Add(new Sprite(317, 312, 35, 59));
            // LEFT
            spriteWalking.Add(new Sprite(160, 19, 61, 42));
            spriteWalking.Add(new Sprite(160, 93, 59, 40));
            spriteWalking.Add(new Sprite(156, 168, 63, 39));
            spriteWalking.Add(new Sprite(156, 242, 64, 41));
            spriteWalking.Add(new Sprite(158, 315, 62, 41));
            // UP-RIGHT
            spriteWalking.Add(new Sprite(94, 9, 47, 58));
            spriteWalking.Add(new Sprite(91, 83, 49, 54));
            spriteWalking.Add(new Sprite(89, 159, 50, 50));
            spriteWalking.Add(new Sprite(90, 233, 49, 56));
            spriteWalking.Add(new Sprite(91, 305, 50, 60));
            // DOWN-RIGHT
            spriteWalking.Add(new Sprite(241, 21, 47, 40));
            spriteWalking.Add(new Sprite(240, 93, 48, 41));
            spriteWalking.Add(new Sprite(240, 167, 46, 43));
            spriteWalking.Add(new Sprite(236, 240, 48, 53));
            spriteWalking.Add(new Sprite(239, 315, 47, 47));

            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteAttacking = new List <Sprite>();

            // MINER UP
            spriteAttacking.Add(new Sprite(14, 383, 43, 60));
            spriteAttacking.Add(new Sprite(20, 4456, 39, 61));
            spriteAttacking.Add(new Sprite(12, 530, 45, 61));
            spriteAttacking.Add(new Sprite(25, 601, 29, 64));
            // MINER DOWN
            spriteAttacking.Add(new Sprite(319, 381, 32, 53));
            spriteAttacking.Add(new Sprite(320, 455, 29, 53));
            spriteAttacking.Add(new Sprite(320, 529, 37, 54));
            spriteAttacking.Add(new Sprite(320, 608, 33, 57));
            // MINER RIGHT
            spriteAttacking.Add(new Sprite(158, 379, 61, 52));
            spriteAttacking.Add(new Sprite(157, 453, 60, 52));
            spriteAttacking.Add(new Sprite(155, 527, 61, 52));
            spriteAttacking.Add(new Sprite(154, 608, 66, 45));
            // MINER UP RIGHT
            spriteAttacking.Add(new Sprite(91, 379, 46, 59));
            spriteAttacking.Add(new Sprite(90, 460, 44, 52));
            spriteAttacking.Add(new Sprite(94, 527, 43, 59));
            spriteAttacking.Add(new Sprite(95, 601, 49, 59));
            // MINER DOWN RIGHT
            spriteAttacking.Add(new Sprite(232, 379, 48, 48));
            spriteAttacking.Add(new Sprite(226, 453, 52, 48));
            spriteAttacking.Add(new Sprite(233, 527, 48, 48));
            spriteAttacking.Add(new Sprite(236, 608, 56, 47));
            sprites.Add(AnimationType.ATTACKING, spriteAttacking);

            List <Sprite> spriteDie = new List <Sprite>();

            spriteDie.Add(new Sprite(11, 752, 57, 39));
            sprites.Add(AnimationType.DYING, spriteDie);

            Dictionary <AnimationType, int> framesCount = new Dictionary <AnimationType, int>();

            framesCount.Add(AnimationType.WALKING, 5);
            framesCount.Add(AnimationType.ATTACKING, 4);
            framesCount.Add(AnimationType.DYING, 1);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            animations.Add("up", new Frame(framesCount));
            animations.Add("down", new Frame(framesCount));
            animations.Add("right", new Frame(framesCount));
            animations.Add("left", new Frame(framesCount, true));
            animations.Add("upRight", new Frame(framesCount));
            animations.Add("downRight", new Frame(framesCount));
            animations.Add("upLeft", new Frame(framesCount, true));
            animations.Add("downLeft", new Frame(framesCount, true));
            animations.Add("dying", new Frame(0, 1));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.Knight(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Knight");

            information = new InformationUnit("Olivaw", Race.HUMAN, Faction.ALLIANCE, 90, 8, 360, 13, 800, 1, Util.Buildings.BARRACKS, 90 * Warcraft.FPS, 8, 1, Util.Units.KNIGHT, 4);
            Information = information;
        }
コード例 #11
0
        public ElvenArcher(int tileX, int tileY, ManagerMouse managerMouse, ManagerMap managerMap, ManagerBuildings managerBuildings, ManagerUnits managerUnits)
            : base(tileX, tileY, 48, 48, 2, managerMouse, managerMap, managerBuildings)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            // UP
            spriteWalking.Add(new Sprite(6, 11, 40, 47));
            spriteWalking.Add(new Sprite(5, 85, 42, 49));
            spriteWalking.Add(new Sprite(5, 159, 41, 47));
            spriteWalking.Add(new Sprite(8, 234, 36, 47));
            spriteWalking.Add(new Sprite(5, 308, 41, 46));
            // DOWN
            spriteWalking.Add(new Sprite(241, 17, 44, 42));
            spriteWalking.Add(new Sprite(239, 92, 43, 41));
            spriteWalking.Add(new Sprite(241, 165, 43, 42));
            spriteWalking.Add(new Sprite(247, 238, 38, 41));
            spriteWalking.Add(new Sprite(244, 312, 41, 41));
            // LEFT
            spriteWalking.Add(new Sprite(128, 16, 38, 40));
            spriteWalking.Add(new Sprite(128, 92, 40, 41));
            spriteWalking.Add(new Sprite(129, 164, 39, 41));
            spriteWalking.Add(new Sprite(129, 240, 35, 38));
            spriteWalking.Add(new Sprite(130, 312, 35, 41));
            // UP-RIGHT
            spriteWalking.Add(new Sprite(67, 12, 42, 45));
            spriteWalking.Add(new Sprite(70, 88, 38, 41));
            spriteWalking.Add(new Sprite(68, 161, 40, 44));
            spriteWalking.Add(new Sprite(65, 230, 41, 46));
            spriteWalking.Add(new Sprite(67, 306, 40, 43));
            // DOWN-RIGHT
            spriteWalking.Add(new Sprite(186, 17, 42, 37));
            spriteWalking.Add(new Sprite(183, 92, 38, 37));
            spriteWalking.Add(new Sprite(184, 165, 40, 38));
            spriteWalking.Add(new Sprite(187, 237, 43, 36));
            spriteWalking.Add(new Sprite(187, 312, 42, 37));
            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteAttacking = new List <Sprite>();

            // UP
            spriteAttacking.Add(new Sprite(10, 373, 45, 52));
            spriteAttacking.Add(new Sprite(10, 452, 44, 48));
            // DOWN
            spriteAttacking.Add(new Sprite(238, 388, 45, 36));
            spriteAttacking.Add(new Sprite(237, 460, 45, 39));
            // LEFT
            spriteAttacking.Add(new Sprite(128, 380, 46, 42));
            spriteAttacking.Add(new Sprite(130, 455, 39, 40));
            // UP-RIGHT
            spriteAttacking.Add(new Sprite(67, 382, 43, 47));
            spriteAttacking.Add(new Sprite(71, 457, 38, 46));
            // DOWN-RIGHT
            spriteAttacking.Add(new Sprite(189, 389, 36, 36));
            spriteAttacking.Add(new Sprite(184, 463, 41, 37));
            sprites.Add(AnimationType.ATTACKING, spriteAttacking);

            List <Sprite> spriteDie = new List <Sprite>();

            spriteDie.Add(new Sprite(181, 530, 44, 43));
            sprites.Add(AnimationType.DYING, spriteDie);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            Dictionary <AnimationType, int> framesCount = new Dictionary <AnimationType, int>();

            framesCount.Add(AnimationType.WALKING, 5);
            framesCount.Add(AnimationType.ATTACKING, 2);
            framesCount.Add(AnimationType.DYING, 1);

            animations.Add("up", new Frame(framesCount));
            animations.Add("down", new Frame(framesCount));
            animations.Add("right", new Frame(framesCount));
            animations.Add("left", new Frame(framesCount, true));
            animations.Add("upRight", new Frame(framesCount));
            animations.Add("downRight", new Frame(framesCount));
            animations.Add("upLeft", new Frame(framesCount, true));
            animations.Add("downLeft", new Frame(framesCount, true));
            animations.Add("dying", new Frame(0, 1));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.ElvenArcher(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Elven Archer");

            information = new InformationUnit("Elven Archer", Race.HIGH_ELF, Faction.ALLIANCE, 150, 20, 360, 10, 500, 1, Util.Buildings.BARRACKS, 400, 20, 100, 4, 0, Util.Units.ELVEN_ARCHER);
            Information = information;
        }
コード例 #12
0
        public Unit(int tileX, int tileY, int width, int height, int speed, ManagerMouse managerMouse, ManagerMap managerMap, ManagerBuildings managerBuildings)
        {
            this.width  = width;
            this.height = height;
            this.speed  = speed;

            pathfinding = new Pathfinding(managerMap);
            position    = new Vector2(tileX * Warcraft.TILE_SIZE, tileY * Warcraft.TILE_SIZE);

            managerMouse.MouseEventHandler += ManagerMouse_MouseEventHandler;

            rectangle = new Rectangle((int)position.X, (int)position.Y, width, height);
        }
コード例 #13
0
        public Grunt(InformationUnit information, ManagerMouse managerMouse, ManagerMap managerMap, ManagerBuildings managerBuildings)
            : base(52, 52, 1, managerMouse, managerMap, managerBuildings)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            // UP
            spriteWalking.Add(new Sprite(22, 8, 38, 43));
            spriteWalking.Add(new Sprite(24, 57, 33, 49));
            spriteWalking.Add(new Sprite(23, 115, 35, 44));
            spriteWalking.Add(new Sprite(23, 171, 38, 44));
            spriteWalking.Add(new Sprite(23, 225, 37, 43));
            // DOWN
            spriteWalking.Add(new Sprite(319, 17, 39, 36));
            spriteWalking.Add(new Sprite(319, 71, 33, 36));
            spriteWalking.Add(new Sprite(321, 125, 34, 37));
            spriteWalking.Add(new Sprite(321, 178, 37, 40));
            spriteWalking.Add(new Sprite(321, 233, 37, 35));
            // LEFT
            spriteWalking.Add(new Sprite(179, 9, 28, 42));
            spriteWalking.Add(new Sprite(172, 63, 43, 40));
            spriteWalking.Add(new Sprite(173, 116, 42, 41));
            spriteWalking.Add(new Sprite(169, 173, 36, 41));
            spriteWalking.Add(new Sprite(172, 225, 28, 39));
            // UP-RIGHT
            spriteWalking.Add(new Sprite(96, 6, 35, 45));
            spriteWalking.Add(new Sprite(98, 60, 37, 41));
            spriteWalking.Add(new Sprite(97, 113, 37, 42));
            spriteWalking.Add(new Sprite(93, 168, 46, 47));
            spriteWalking.Add(new Sprite(94, 221, 39, 47));
            // DOWN-RIGHT
            spriteWalking.Add(new Sprite(249, 12, 32, 38));
            spriteWalking.Add(new Sprite(243, 69, 39, 40));
            spriteWalking.Add(new Sprite(245, 121, 38, 41));
            spriteWalking.Add(new Sprite(248, 171, 31, 41));
            spriteWalking.Add(new Sprite(246, 227, 34, 37));
            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteAttacking = new List <Sprite>();

            // UP
            spriteAttacking.Add(new Sprite(5, 279, 53, 44));
            spriteAttacking.Add(new Sprite(16, 336, 41, 45));
            spriteAttacking.Add(new Sprite(8, 393, 49, 42));
            spriteAttacking.Add(new Sprite(28, 440, 29, 51));
            // DOWN
            spriteAttacking.Add(new Sprite(320, 284, 53, 36));
            spriteAttacking.Add(new Sprite(320, 327, 35, 48));
            spriteAttacking.Add(new Sprite(316, 385, 49, 49));
            spriteAttacking.Add(new Sprite(315, 454, 35, 51));
            // LEFT
            spriteAttacking.Add(new Sprite(172, 271, 36, 51));
            spriteAttacking.Add(new Sprite(153, 328, 53, 50));
            spriteAttacking.Add(new Sprite(177, 385, 30, 51));
            spriteAttacking.Add(new Sprite(173, 452, 52, 39));
            // UP-RIGHT
            spriteAttacking.Add(new Sprite(89, 278, 45, 44));
            spriteAttacking.Add(new Sprite(79, 335, 55, 43));
            spriteAttacking.Add(new Sprite(84, 392, 55, 44));
            spriteAttacking.Add(new Sprite(104, 445, 46, 46));
            // DOWN-RIGHT
            spriteAttacking.Add(new Sprite(251, 271, 28, 50));
            spriteAttacking.Add(new Sprite(251, 327, 27, 50));
            spriteAttacking.Add(new Sprite(250, 385, 32, 51));
            spriteAttacking.Add(new Sprite(242, 458, 52, 40));
            sprites.Add(AnimationType.ATTACKING, spriteAttacking);

            List <Sprite> spriteDiying = new List <Sprite>();

            spriteDiying.Add(new Sprite(17, 569, 45, 51));
            sprites.Add(AnimationType.DYING, spriteDiying);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            Dictionary <AnimationType, int> framesCount = new Dictionary <AnimationType, int>();

            framesCount.Add(AnimationType.WALKING, 5);
            framesCount.Add(AnimationType.ATTACKING, 4);
            framesCount.Add(AnimationType.DYING, 1);

            animations.Add("up", new Frame(framesCount));
            animations.Add("down", new Frame(framesCount));
            animations.Add("right", new Frame(framesCount));
            animations.Add("left", new Frame(framesCount, true));
            animations.Add("upRight", new Frame(framesCount));
            animations.Add("downRight", new Frame(framesCount));
            animations.Add("upLeft", new Frame(framesCount, true));
            animations.Add("downLeft", new Frame(framesCount, true));
            animations.Add("dying", new Frame(0, 1));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.Grunt(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Grunt");

            this.information = information;
            Information      = information;
        }
コード例 #14
0
        public TrollAxethrower(InformationUnit information, ManagerMouse managerMouse, ManagerMap managerMap, ManagerBuildings managerBuildings)
            : base(52, 52, 1, managerMouse, managerMap, managerBuildings)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            // UP
            spriteWalking.Add(new Sprite(21, 9, 34, 46));
            spriteWalking.Add(new Sprite(25, 60, 29, 48));
            spriteWalking.Add(new Sprite(22, 113, 32, 46));
            spriteWalking.Add(new Sprite(18, 163, 38, 47));
            spriteWalking.Add(new Sprite(19, 220, 37, 47));
            // DOWN
            spriteWalking.Add(new Sprite(256, 11, 34, 43));
            spriteWalking.Add(new Sprite(258, 63, 32, 44));
            spriteWalking.Add(new Sprite(257, 114, 33, 42));
            spriteWalking.Add(new Sprite(265, 166, 39, 44));
            spriteWalking.Add(new Sprite(257, 221, 33, 41));
            // LEFT
            spriteWalking.Add(new Sprite(151, 11, 32, 43));
            spriteWalking.Add(new Sprite(144, 63, 39, 42));
            spriteWalking.Add(new Sprite(144, 114, 38, 42));
            spriteWalking.Add(new Sprite(146, 165, 36, 42));
            spriteWalking.Add(new Sprite(146, 220, 31, 41));
            // UP-RIGHT
            spriteWalking.Add(new Sprite(83, 11, 28, 44));
            spriteWalking.Add(new Sprite(82, 63, 34, 42));
            spriteWalking.Add(new Sprite(82, 113, 32, 41));
            spriteWalking.Add(new Sprite(75, 164, 47, 50));
            spriteWalking.Add(new Sprite(79, 219, 37, 48));
            // DOWN-RIGHT
            spriteWalking.Add(new Sprite(200, 11, 39, 42));
            spriteWalking.Add(new Sprite(197, 62, 41, 45));
            spriteWalking.Add(new Sprite(200, 113, 38, 44));
            spriteWalking.Add(new Sprite(201, 165, 33, 39));
            spriteWalking.Add(new Sprite(201, 223, 34, 37));
            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteAttacking = new List <Sprite>();

            // UP
            spriteAttacking.Add(new Sprite(12, 280, 37, 46));
            spriteAttacking.Add(new Sprite(20, 333, 29, 58));
            spriteAttacking.Add(new Sprite(4, 401, 52, 45));
            spriteAttacking.Add(new Sprite(24, 450, 34, 47));
            // DOWN
            spriteAttacking.Add(new Sprite(261, 271, 43, 47));
            spriteAttacking.Add(new Sprite(261, 330, 26, 48));
            spriteAttacking.Add(new Sprite(255, 403, 53, 39));
            spriteAttacking.Add(new Sprite(249, 458, 38, 44));
            // LEFT
            spriteAttacking.Add(new Sprite(140, 272, 42, 50));
            spriteAttacking.Add(new Sprite(127, 337, 55, 45));
            spriteAttacking.Add(new Sprite(146, 396, 34, 51));
            spriteAttacking.Add(new Sprite(146, 456, 34, 43));
            // UP-RIGHT
            spriteAttacking.Add(new Sprite(75, 278, 37, 45));
            spriteAttacking.Add(new Sprite(64, 333, 45, 52));
            spriteAttacking.Add(new Sprite(74, 396, 45, 51));
            spriteAttacking.Add(new Sprite(84, 458, 32, 42));
            // DOWN-RIGHT
            spriteAttacking.Add(new Sprite(203, 270, 36, 51));
            spriteAttacking.Add(new Sprite(196, 330, 45, 51));
            spriteAttacking.Add(new Sprite(205, 394, 35, 51));
            spriteAttacking.Add(new Sprite(191, 454, 41, 45));
            sprites.Add(AnimationType.ATTACKING, spriteAttacking);

            List <Sprite> spriteDiying = new List <Sprite>();

            spriteDiying.Add(new Sprite(16, 568, 45, 50));
            sprites.Add(AnimationType.DYING, spriteDiying);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            Dictionary <AnimationType, int> framesCount = new Dictionary <AnimationType, int>();

            framesCount.Add(AnimationType.WALKING, 5);
            framesCount.Add(AnimationType.ATTACKING, 4);
            framesCount.Add(AnimationType.DYING, 1);

            animations.Add("up", new Frame(framesCount));
            animations.Add("down", new Frame(framesCount));
            animations.Add("right", new Frame(framesCount));
            animations.Add("left", new Frame(framesCount, true));
            animations.Add("upRight", new Frame(framesCount));
            animations.Add("downRight", new Frame(framesCount));
            animations.Add("upLeft", new Frame(framesCount, true));
            animations.Add("downLeft", new Frame(framesCount, true));
            animations.Add("dying", new Frame(0, 1));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.TrollAxethrower(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Troll Axethrower");

            this.information = information;
            Information      = information;
        }
コード例 #15
0
ファイル: Miner.cs プロジェクト: yufeixuan/warcraft
 public Miner(ManagerBuildings managerBuildings, ManagerUnits managerUnits, Unit worker)
 {
     this.worker           = worker;
     this.managerBuildings = managerBuildings;
     this.managerUnits     = managerUnits;
 }
コード例 #16
0
ファイル: Battleship.cs プロジェクト: yufeixuan/warcraft
        public Battleship(int tileX, int tileY, int lastX, ManagerMouse managerMouse, ManagerMap managerMap, ManagerUnits managerUnits, ManagerBuildings managerBuildings, ManagerEnemies managerEnemies)
            : base(tileX, tileY, 96, 96, 1, managerMouse, managerMap, managerUnits)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            spriteWalking.Add(new Sprite(19, 6, 52, 81));
            spriteWalking.Add(new Sprite(18, 93, 52, 88));
            spriteWalking.Add(new Sprite(186, 7, 84, 67));
            spriteWalking.Add(new Sprite(102, 4, 67, 83));
            spriteWalking.Add(new Sprite(281, 0, 80, 88));
            sprites.Add(AnimationType.WALKING, spriteWalking);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            animations.Add("up", new Frame(0, 1));
            animations.Add("down", new Frame(1, 1));
            animations.Add("right", new Frame(2, 1));
            animations.Add("left", new Frame(2, 1, true));
            animations.Add("upRight", new Frame(3, 1));
            animations.Add("downRight", new Frame(4, 1));
            animations.Add("upLeft", new Frame(3, 1, true));
            animations.Add("downLeft", new Frame(4, 5, true));

            this.animations = new Animation(sprites, animations, "down", width, height);

            textureName.Add(AnimationType.WALKING, "Battleship");

            information = new InformationUnit("Battleship", Race.HUMAN, Faction.ALLIANCE, 9999, 0, 0, 10, 0, 0, Util.Buildings.NONE, 0, 0, 0, Util.Units.BATTLESHIP, 0);
            Information = information;

            managerMouse.MouseEventHandler += (sender, e) => {
                if (e.SelectRectangle.Intersects(rectangle) && !move)
                {
                    int total = 0, dead = 0;
                    managerEnemies.managerUnits.units.ForEach(unit => {
                        if (!(unit is Skeleton))
                        {
                            total++;
                            if (unit.information.HitPoints <= 0)
                            {
                                dead++;
                            }
                        }
                    });

                    if (total == dead && managerEnemies.managerBuildings.buildings.Count < 2)
                    {
                        if (managerEnemies.managerBuildings.buildings.Count == 0 || (managerEnemies.managerBuildings.buildings.Count == 1 && managerEnemies.managerBuildings.buildings[0] is DarkPortal))
                        {
                            goal       = new Vector2(lastX * Warcraft.TILE_SIZE, position.Y + 5 * Warcraft.TILE_SIZE);
                            transition = true;
                            move       = true;

                            Warcraft.ISLAND++;

                            if (Warcraft.ISLAND > 2)
                            {
                                Warcraft.ISLAND = 0;
                            }
                        }
                    }
                }
            };
        }
コード例 #17
0
        public Footman(int tileX, int tileY, ManagerMouse managerMouse, ManagerMap managerMap, ManagerBuildings managerBuildings, ManagerUnits managerUnits)
            : base(tileX, tileY, 52, 52, 2, managerMouse, managerMap, managerBuildings)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            // UP
            spriteWalking.Add(new Sprite(22, 10, 31, 40));
            spriteWalking.Add(new Sprite(22, 62, 30, 52));
            spriteWalking.Add(new Sprite(22, 119, 30, 49));
            spriteWalking.Add(new Sprite(23, 182, 29, 37));
            spriteWalking.Add(new Sprite(22, 230, 31, 37));
            // DOWN
            spriteWalking.Add(new Sprite(316, 12, 32, 46));
            spriteWalking.Add(new Sprite(315, 72, 29, 42));
            spriteWalking.Add(new Sprite(316, 128, 30, 44));
            spriteWalking.Add(new Sprite(318, 178, 31, 42));
            spriteWalking.Add(new Sprite(316, 226, 32, 45));
            // LEFT
            spriteWalking.Add(new Sprite(176, 12, 32, 37));
            spriteWalking.Add(new Sprite(168, 73, 45, 37));
            spriteWalking.Add(new Sprite(170, 127, 39, 38));
            spriteWalking.Add(new Sprite(170, 179, 32, 33));
            spriteWalking.Add(new Sprite(169, 226, 35, 34));
            // UP-RIGHT
            spriteWalking.Add(new Sprite(99, 10, 25, 39));
            spriteWalking.Add(new Sprite(94, 65, 39, 41));
            spriteWalking.Add(new Sprite(95, 123, 32, 40));
            spriteWalking.Add(new Sprite(97, 179, 33, 38));
            spriteWalking.Add(new Sprite(99, 225, 31, 39));
            // DOWN-RIGHT
            spriteWalking.Add(new Sprite(244, 13, 40, 35));
            spriteWalking.Add(new Sprite(240, 74, 43, 40));
            spriteWalking.Add(new Sprite(242, 129, 41, 37));
            spriteWalking.Add(new Sprite(244, 177, 36, 35));
            spriteWalking.Add(new Sprite(244, 227, 38, 31));
            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteAttacking = new List <Sprite>();

            // UP
            spriteAttacking.Add(new Sprite(2, 287, 48, 37));
            spriteAttacking.Add(new Sprite(15, 335, 32, 58));
            spriteAttacking.Add(new Sprite(2, 409, 56, 37));
            spriteAttacking.Add(new Sprite(27, 452, 28, 50));
            // DOWN
            spriteAttacking.Add(new Sprite(319, 285, 46, 38));
            spriteAttacking.Add(new Sprite(321, 329, 31, 47));
            spriteAttacking.Add(new Sprite(313, 398, 51, 47));
            spriteAttacking.Add(new Sprite(312, 466, 32, 54));
            // LEFT
            spriteAttacking.Add(new Sprite(172, 275, 33, 49));
            spriteAttacking.Add(new Sprite(151, 336, 58, 42));
            spriteAttacking.Add(new Sprite(164, 396, 40, 49));
            spriteAttacking.Add(new Sprite(173, 466, 47, 35));
            // UP-RIGHT
            spriteAttacking.Add(new Sprite(77, 286, 52, 38));
            spriteAttacking.Add(new Sprite(77, 338, 50, 40));
            spriteAttacking.Add(new Sprite(78, 396, 55, 49));
            spriteAttacking.Add(new Sprite(101, 453, 45, 48));
            // DOWN-RIGHT
            spriteAttacking.Add(new Sprite(248, 275, 22, 48));
            spriteAttacking.Add(new Sprite(241, 329, 35, 48));
            spriteAttacking.Add(new Sprite(246, 396, 35, 52));
            spriteAttacking.Add(new Sprite(233, 467, 61, 33));
            sprites.Add(AnimationType.ATTACKING, spriteAttacking);

            List <Sprite> spriteDie = new List <Sprite>();

            spriteDie.Add(new Sprite(236, 533, 47, 40));
            sprites.Add(AnimationType.DYING, spriteDie);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            Dictionary <AnimationType, int> framesCount = new Dictionary <AnimationType, int>();

            framesCount.Add(AnimationType.WALKING, 5);
            framesCount.Add(AnimationType.ATTACKING, 4);
            framesCount.Add(AnimationType.DYING, 1);

            animations.Add("up", new Frame(framesCount));
            animations.Add("down", new Frame(framesCount));
            animations.Add("right", new Frame(framesCount));
            animations.Add("left", new Frame(framesCount, true));
            animations.Add("upRight", new Frame(framesCount));
            animations.Add("downRight", new Frame(framesCount));
            animations.Add("upLeft", new Frame(framesCount, true));
            animations.Add("downLeft", new Frame(framesCount, true));
            animations.Add("dying", new Frame(0, 1));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.Footman(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Footman");

            information = new InformationUnit("Footman", Race.HUMAN, Faction.ALLIANCE, 60, 6, 360, 10, 600, 1, Util.Buildings.BARRACKS, 300, 15, 90, 1, 0, Util.Units.FOOTMAN);
            Information = information;
        }
コード例 #18
0
ファイル: Ballista.cs プロジェクト: yufeixuan/warcraft
        public Ballista(int tileX, int tileY, ManagerMouse managerMouse, ManagerMap managerMap, ManagerUnits managerUnits, ManagerBuildings managerBuildings)
            : base(tileX, tileY, 64, 64, 1, managerMouse, managerMap, managerUnits)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            spriteWalking.Add(new Sprite(3, 0, 58, 59));
            spriteWalking.Add(new Sprite(269, 0, 55, 60));
            spriteWalking.Add(new Sprite(133, 1, 62, 54));
            spriteWalking.Add(new Sprite(68, 1, 61, 60));
            spriteWalking.Add(new Sprite(200, 0, 62, 62));

            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteAttacking = new List <Sprite>();

            // MINER UP
            spriteAttacking.Add(new Sprite(3, 0, 58, 59));
            spriteAttacking.Add(new Sprite(3, 66, 58, 58));
            spriteAttacking.Add(new Sprite(6, 133, 52, 57));
            spriteAttacking.Add(new Sprite(2, 199, 60, 57));
            // MINER DOWN
            spriteAttacking.Add(new Sprite(269, 0, 55, 60));
            spriteAttacking.Add(new Sprite(269, 66, 55, 60));
            spriteAttacking.Add(new Sprite(269, 132, 55, 59));
            spriteAttacking.Add(new Sprite(268, 198, 57, 59));
            // MINER RIGHT
            spriteAttacking.Add(new Sprite(133, 1, 62, 54));
            spriteAttacking.Add(new Sprite(133, 67, 62, 54));
            spriteAttacking.Add(new Sprite(133, 135, 62, 52));
            spriteAttacking.Add(new Sprite(133, 198, 62, 55));
            // MINER UP RIGHT
            spriteAttacking.Add(new Sprite(68, 1, 61, 60));
            spriteAttacking.Add(new Sprite(68, 67, 61, 59));
            spriteAttacking.Add(new Sprite(68, 133, 61, 59));
            spriteAttacking.Add(new Sprite(68, 198, 62, 60));
            // MINER DOWN RIGHT
            spriteAttacking.Add(new Sprite(200, 0, 62, 62));
            spriteAttacking.Add(new Sprite(200, 66, 62, 62));
            spriteAttacking.Add(new Sprite(200, 132, 62, 62));
            spriteAttacking.Add(new Sprite(200, 198, 62, 62));
            sprites.Add(AnimationType.GOLD, spriteAttacking);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            animations.Add("up", new Frame(0, 1));
            animations.Add("down", new Frame(1, 1));
            animations.Add("right", new Frame(2, 1));
            animations.Add("left", new Frame(2, 1, true));
            animations.Add("upRight", new Frame(3, 1));
            animations.Add("downRight", new Frame(4, 1));
            animations.Add("upLeft", new Frame(3, 1, true));
            animations.Add("downLeft", new Frame(4, 5, true));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.Ballista(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Ballista");
            textureName.Add(AnimationType.ATTACKING, "Ballista");
            textureName.Add(AnimationType.DYING, "Ballista");

            information = new InformationUnit("Ballista", Race.HUMAN, Faction.ALLIANCE, 110, 0, 360, 5, 900, 1, Util.Buildings.BARRACKS, 250 * Warcraft.FPS, 80, 8, Util.Units.BALLISTA, 0);
            Information = information;
        }
コード例 #19
0
        public Peasant(int tileX, int tileY, ManagerMouse managerMouse, ManagerMap managerMap, ManagerUnits managerUnits, ManagerBuildings managerBuildings)
            : base(tileX, tileY, managerMouse, managerMap, managerUnits)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            // UP
            spriteWalking.Add(new Sprite(16, 8, 26, 23));
            spriteWalking.Add(new Sprite(18, 46, 24, 28));
            spriteWalking.Add(new Sprite(17, 86, 25, 26));
            spriteWalking.Add(new Sprite(19, 122, 23, 30));
            spriteWalking.Add(new Sprite(18, 159, 24, 27));
            // DOWN
            spriteWalking.Add(new Sprite(166, 7, 25, 26));
            spriteWalking.Add(new Sprite(168, 45, 24, 26));
            spriteWalking.Add(new Sprite(167, 85, 25, 27));
            spriteWalking.Add(new Sprite(168, 121, 23, 26));
            spriteWalking.Add(new Sprite(167, 158, 24, 27));
            // LEFT
            spriteWalking.Add(new Sprite(97, 4, 14, 31));
            spriteWalking.Add(new Sprite(91, 42, 24, 30));
            spriteWalking.Add(new Sprite(96, 82, 16, 31));
            spriteWalking.Add(new Sprite(91, 118, 23, 30));
            spriteWalking.Add(new Sprite(95, 155, 20, 30));
            // UP-RIGHT
            spriteWalking.Add(new Sprite(56, 6, 22, 26));
            spriteWalking.Add(new Sprite(55, 44, 26, 30));
            spriteWalking.Add(new Sprite(56, 84, 24, 29));
            spriteWalking.Add(new Sprite(59, 119, 23, 29));
            spriteWalking.Add(new Sprite(57, 156, 21, 28));
            // DOWN-RIGHT
            spriteWalking.Add(new Sprite(127, 3, 22, 31));
            spriteWalking.Add(new Sprite(128, 40, 20, 27));
            spriteWalking.Add(new Sprite(130, 80, 19, 28));
            spriteWalking.Add(new Sprite(126, 119, 26, 29));
            spriteWalking.Add(new Sprite(126, 156, 26, 28));

            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteGold = new List <Sprite>();

            // MINER UP
            spriteGold.Add(new Sprite(29, 10, 24, 27));
            spriteGold.Add(new Sprite(30, 52, 23, 30));
            spriteGold.Add(new Sprite(30, 95, 23, 28));
            spriteGold.Add(new Sprite(30, 137, 24, 32));
            spriteGold.Add(new Sprite(30, 180, 24, 30));
            // MINER DOWN
            spriteGold.Add(new Sprite(159, 1, 23, 36));
            spriteGold.Add(new Sprite(160, 43, 23, 36));
            spriteGold.Add(new Sprite(160, 86, 23, 37));
            spriteGold.Add(new Sprite(158, 131, 24, 34));
            spriteGold.Add(new Sprite(158, 173, 24, 36));
            // MINER RIGHT
            spriteGold.Add(new Sprite(97, 7, 21, 31));
            spriteGold.Add(new Sprite(96, 50, 24, 30));
            spriteGold.Add(new Sprite(96, 93, 23, 30));
            spriteGold.Add(new Sprite(98, 134, 22, 32));
            spriteGold.Add(new Sprite(97, 177, 23, 31));
            // MINER UP RIGHT
            spriteGold.Add(new Sprite(62, 7, 24, 31));
            spriteGold.Add(new Sprite(62, 49, 25, 34));
            spriteGold.Add(new Sprite(62, 91, 25, 33));
            spriteGold.Add(new Sprite(62, 135, 25, 30));
            spriteGold.Add(new Sprite(62, 178, 24, 30));
            // MINER DOWN RIGHT
            spriteGold.Add(new Sprite(129, 1, 21, 37));
            spriteGold.Add(new Sprite(127, 44, 22, 34));
            spriteGold.Add(new Sprite(129, 87, 21, 37));
            spriteGold.Add(new Sprite(128, 130, 22, 37));
            spriteGold.Add(new Sprite(129, 173, 21, 37));
            sprites.Add(AnimationType.GOLD, spriteGold);

            List <Sprite> spriteDie = new List <Sprite>();

            spriteDie.Add(new Sprite(10, 50, 33, 33));
            sprites.Add(AnimationType.DYING, spriteDie);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            animations.Add("up", new Frame(0, 5));
            animations.Add("down", new Frame(5, 5));
            animations.Add("right", new Frame(10, 5));
            animations.Add("left", new Frame(10, 5, true));
            animations.Add("upRight", new Frame(15, 5));
            animations.Add("downRight", new Frame(20, 5));
            animations.Add("upLeft", new Frame(15, 5, true));
            animations.Add("downLeft", new Frame(20, 5, true));
            animations.Add("dying", new Frame(0, 1));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.Builder(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Peasant_walking");
            textureName.Add(AnimationType.GOLD, "Peasant_gold");
            textureName.Add(AnimationType.DYING, "Peasant_dying");

            information = new InformationUnit("Peasant", Race.HUMAN, Faction.ALLIANCE, 30, 0, 4, 10, 400, 1, Util.Buildings.TOWN_HALL, 45 * Warcraft.FPS, 3, 1, Util.Units.PEASANT, 2);
            Information = information;

            commands.Add(new BuilderBuildings(Util.Buildings.TOWN_HALL, this, managerMouse, managerBuildings, managerUnits));
            commands.Add(new BuilderBuildings(Util.Buildings.BARRACKS, this, managerMouse, managerBuildings, managerUnits));
            commands.Add(new BuilderBuildings(Util.Buildings.CHICKEN_FARM, this, managerMouse, managerBuildings, managerUnits));
            commands.Add(new BuilderWalls(this, managerMouse, managerBuildings, managerUnits));
            if (Warcraft.ISLAND > 0)
            {
                commands.Add(new BuilderBuildings(Util.Buildings.CHURCH, this, managerMouse, managerBuildings, managerUnits));
            }
            commands.Add(new Miner(managerBuildings, managerUnits, this));
        }
コード例 #20
0
ファイル: Dwarven.cs プロジェクト: yufeixuan/warcraft
        public Dwarven(int tileX, int tileY, ManagerMouse managerMouse, ManagerMap managerMap, ManagerUnits managerUnits, ManagerBuildings managerBuildings)
            : base(tileX, tileY, 64, 64, 1, managerMouse, managerMap, managerUnits)
        {
            Dictionary <AnimationType, List <Sprite> > sprites = new Dictionary <AnimationType, List <Sprite> >();
            List <Sprite> spriteWalking = new List <Sprite>();

            // UP
            spriteWalking.Add(new Sprite(12, 8, 34, 37));
            spriteWalking.Add(new Sprite(11, 58, 38, 40));
            // DOWN
            spriteWalking.Add(new Sprite(244, 6, 35, 42));
            spriteWalking.Add(new Sprite(245, 57, 32, 43));
            // LEFT
            spriteWalking.Add(new Sprite(126, 3, 41, 39));
            spriteWalking.Add(new Sprite(120, 54, 51, 43));
            // UP-RIGHT
            spriteWalking.Add(new Sprite(67, 9, 38, 39));
            spriteWalking.Add(new Sprite(64, 61, 44, 37));
            // DOWN-RIGHT
            spriteWalking.Add(new Sprite(182, 5, 45, 41));
            spriteWalking.Add(new Sprite(179, 56, 45, 41));

            sprites.Add(AnimationType.WALKING, spriteWalking);

            List <Sprite> spriteAttacking = new List <Sprite>();

            // MINER UP
            spriteAttacking.Add(new Sprite(14, 383, 43, 60));
            spriteAttacking.Add(new Sprite(20, 4456, 39, 61));
            spriteAttacking.Add(new Sprite(12, 530, 45, 61));
            spriteAttacking.Add(new Sprite(25, 601, 29, 64));
            // MINER DOWN
            spriteAttacking.Add(new Sprite(319, 381, 32, 53));
            spriteAttacking.Add(new Sprite(320, 455, 29, 53));
            spriteAttacking.Add(new Sprite(320, 529, 37, 54));
            spriteAttacking.Add(new Sprite(320, 608, 33, 57));
            // MINER RIGHT
            spriteAttacking.Add(new Sprite(158, 379, 61, 52));
            spriteAttacking.Add(new Sprite(157, 453, 60, 52));
            spriteAttacking.Add(new Sprite(155, 527, 61, 52));
            spriteAttacking.Add(new Sprite(154, 608, 66, 45));
            // MINER UP RIGHT
            spriteAttacking.Add(new Sprite(91, 379, 46, 59));
            spriteAttacking.Add(new Sprite(90, 460, 44, 52));
            spriteAttacking.Add(new Sprite(94, 527, 43, 59));
            spriteAttacking.Add(new Sprite(95, 601, 49, 59));
            // MINER DOWN RIGHT
            spriteAttacking.Add(new Sprite(232, 379, 48, 48));
            spriteAttacking.Add(new Sprite(226, 453, 52, 48));
            spriteAttacking.Add(new Sprite(233, 527, 48, 48));
            spriteAttacking.Add(new Sprite(236, 608, 56, 47));
            sprites.Add(AnimationType.GOLD, spriteAttacking);

            List <Sprite> spriteDie = new List <Sprite>();

            spriteDie.Add(new Sprite(11, 752, 57, 39));
            sprites.Add(AnimationType.DYING, spriteDie);

            Dictionary <string, Frame> animations = new Dictionary <string, Frame>();

            animations.Add("up", new Frame(0, 2));
            animations.Add("down", new Frame(2, 2));
            animations.Add("right", new Frame(4, 2));
            animations.Add("left", new Frame(4, 2, true));
            animations.Add("upRight", new Frame(6, 2));
            animations.Add("downRight", new Frame(8, 2));
            animations.Add("upLeft", new Frame(6, 2, true));
            animations.Add("downLeft", new Frame(8, 2, true));
            animations.Add("dying", new Frame(0, 1));

            this.animations = new Animation(sprites, animations, "down", width, height);

            ui = new UI.Units.Dwarven(managerMouse, this);
            textureName.Add(AnimationType.WALKING, "Dwarven");
            textureName.Add(AnimationType.ATTACKING, "Dwarven");
            textureName.Add(AnimationType.DYING, "Dwarven");

            information = new InformationUnit("Dwarven", Race.HUMAN, Faction.ALLIANCE, 30, 0, 4, 10, 400, 1, Util.Buildings.TOWN_HALL, 200 * Warcraft.FPS, 3, 1, Util.Units.PEASANT, 2);
            Information = information;
        }
コード例 #21
0
 public UnitEnemy(int width, int height, int speed, ManagerMouse managerMouse, ManagerMap managerMap, ManagerBuildings managerBuildings)
     : base(0, 0, width, height, speed, managerMouse, managerMap, managerBuildings)
 {
 }