public bool AddEnemy() { Enemy e; if (Util.NextDouble() > 0.5) { e = new Enemy(Util.OctoTexture); e.Color = Color.Brown; } else { e = new SquareEnemy(); } int x = Util.Next(1, Width); int y = Util.Next(1, Height); // Only add enemy if not on solid tile if (!GetTile(x, y).IsSolid()) { e.Position = new Vector2(x * Tile.Size, y * Tile.Size); e.Path = Pathfinder.FindPath(new Point(e.X / Tile.Size, e.Y / Tile.Size), new Point(Player.X / Tile.Size, Player.Y / Tile.Size)); e.Target = Player; AddEntity(e); return(true); } return(false); }
public bool AddEnemy() { Enemy e; if (Util.NextDouble() > 0.5) { e = new Enemy(Util.OctoTexture); e.Color = Color.Brown; } else { e = new SquareEnemy(); } int x = Util.Next(1, Width); int y = Util.Next(1, Height); // Only add enemy if not on solid tile if (!GetTile(x, y).IsSolid()) { e.Position = new Vector2(x * Tile.Size, y * Tile.Size); e.Path = Pathfinder.FindPath(new Point(e.X / Tile.Size, e.Y / Tile.Size), new Point(Player.X / Tile.Size, Player.Y / Tile.Size)); e.Target = Player; AddEntity(e); return true; } return false; }