Example #1
0
 public static void Initialize(Zombicide game)
 {
     zombieList = new List <Zombie>();
     WalkerIcon = game.Content.Load <Texture2D>(@"ZombieIcons/Walker");
     RunnerIcon = game.Content.Load <Texture2D>(@"ZombieIcons/Runner");
     FattyIcon  = game.Content.Load <Texture2D>(@"ZombieIcons/Fatty");
 }
Example #2
0
 private bool CheckCanAttack(Zombicide game, Zombie Z)
 {
     if (Z.ZombieTile[0] == PlayerTile.row && Math.Abs(Z.ZombieTile[1] - PlayerTile.column) <= ActiveWeapon.MaxRange && Math.Abs(Z.ZombieTile[1] - PlayerTile.column) >= ActiveWeapon.MinRange)
     {
         return(true);
     }
     else if (Z.ZombieTile[1] == PlayerTile.column && Math.Abs(Z.ZombieTile[0] - PlayerTile.row) <= ActiveWeapon.MaxRange && Math.Abs(Z.ZombieTile[0] - PlayerTile.row) >= ActiveWeapon.MinRange)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #3
0
        internal int Attack(Zombicide game, Zombie Z)
        {
            int hits = 0;

            if (CheckCanAttack(game, Z))
            {
                Dice.addDice(ActiveWeapon.Dice);
                Dice.Roll();
                hits = Dice.CalculateHits(ActiveWeapon.DiceThreshold);
                var mainScreen = (MainGameScreen)game.CurrentScreen;
                mainScreen.DicePopup();
                movesLeft--;
            }
            return(hits);
        }
Example #4
0
        public void Update(Zombicide game)
        {
            //This handles move animation
            if (moving == true)
            {
                if (Position != new Point(MainGameScreen.mapX + (Convert.ToInt32(PlayerTile.column) * MainGameScreen.tileWidth) + (MainGameScreen.tileWidth / 2) - (Size.X / 2), MainGameScreen.mapY + (Convert.ToInt32(PlayerTile.row) * MainGameScreen.tileHeight) + (MainGameScreen.tileHeight / 2)))
                {
                    animationOffset++;
                    int Ydir = PlayerTile.row - LastTile.row;
                    int Xdir = PlayerTile.column - LastTile.column;
                    Position = new Point((MainGameScreen.mapX + (Convert.ToInt32(LastTile.column) * MainGameScreen.tileWidth) + (MainGameScreen.tileWidth / 2) - (Size.X / 2)) + (animationOffset * Xdir), (MainGameScreen.mapY + (Convert.ToInt32(LastTile.row) * MainGameScreen.tileHeight) + (MainGameScreen.tileHeight / 2)) + (animationOffset * Ydir));
                }
                else
                {
                    moving = false; animationOffset = 0;
                }
            }
            else
            {
                Position = new Point(MainGameScreen.mapX + (Convert.ToInt32(PlayerTile.column) * MainGameScreen.tileWidth) + (MainGameScreen.tileWidth / 2) - (Size.X / 2), MainGameScreen.mapY + (Convert.ToInt32(PlayerTile.row) * MainGameScreen.tileHeight) + (MainGameScreen.tileHeight / 2));
            }

            var equipped = new List <Item>();

            if (MainHandSlot != null)
            {
                equipped.Add(MainHandSlot);
            }
            if (OffHandSlot != null)
            {
                equipped.Add(OffHandSlot);
            }
            if (ArmorSlot != null)
            {
                equipped.Add(ArmorSlot);
            }
            if (!equipped.Exists(x => ((Weapon)x).Active == true))
            {
                SetActiveWeapon("MAIN");
            }

            ActiveWeapon = (((Weapon)MainHandSlot).Active) ? (Weapon)MainHandSlot : (Weapon)OffHandSlot;
        }
Example #5
0
 public void Update(Zombicide game)
 {
     if (Moving == true)
     {
         if (!new Rectangle(new Point(MainGameScreen.mapX + PositionOffset.X + ZombieTile[1] * MainGameScreen.tileWidth, MainGameScreen.mapY + PositionOffset.Y + ZombieTile[0] * MainGameScreen.tileHeight), new Point(15, 15)).Contains(Position))
         {
             animationOffset++;
             int Ydir = ZombieTile[0] - LastTile[0];
             int Xdir = ZombieTile[1] - LastTile[1];
             Position = new Point((MainGameScreen.mapX + PositionOffset.X + LastTile[1] * MainGameScreen.tileWidth) + (animationOffset * Xdir), (MainGameScreen.mapY + PositionOffset.Y + LastTile[0] * MainGameScreen.tileHeight) + (animationOffset * Ydir));
         }
         else
         {
             Moving = false; animationOffset = 0;
         }
     }
     else
     {
         Position = new Point(MainGameScreen.mapX + PositionOffset.X + ZombieTile[1] * MainGameScreen.tileWidth, MainGameScreen.mapY + PositionOffset.Y + ZombieTile[0] * MainGameScreen.tileHeight);
     }
 }
Example #6
0
 public override void Draw(Zombicide game)
 {
     base.Draw(game);
     game.SpriteBatch.DrawString(MainGameScreen.Impact, zombieList.Where(x => x.ZombieTile[0] == ZombieTile[0] && x.ZombieTile[1] == ZombieTile[1] && x is Walker).Count().ToString(), new Vector2(Position.X + NumberOffset.X, Position.Y + NumberOffset.Y), Color.Black);
 }
Example #7
0
 public void Draw(Zombicide game)
 {
     game.SpriteBatch.Draw(Texture, new Rectangle(Position, Size), Color.White);
 }
Example #8
0
 public static void Initialize(Zombicide game, char initial)
 {
     PlayerIcon = game.Content.Load <Texture2D>(@"playerIcons/" + initial);
     EmptyHand  = game.Content.Load <Texture2D>(@"EmptyHand");
     EmptyArmor = game.Content.Load <Texture2D>("ArmorSlot");
 }
Example #9
0
 public virtual void Draw(Zombicide game)
 {
     game.SpriteBatch.Draw(Texture, new Rectangle(Position, Size), Color.White);
     //game.SpriteBatch.DrawString(MainGameScreen.Impact, zombieList.Where(x => x.ZombieTile[0] == ZombieTile[0] && x.ZombieTile[1] == ZombieTile[1]).Count().ToString(), new Vector2(Position.X + NumberOffset.X, Position.Y + NumberOffset.Y), Color.Black);
 }