public static GameBoss Create(Texture2D texture, Vector2 velocity, Vector2 position, BossTypes bossType, List <BulletPatterns> bulletPatterns) { return(new GameBoss() { Texture = texture, Velocity = velocity, Position = position, Color = Color.Red, BossType = bossType, Health = 500, Radius = 30f, Orientation = 0f, HitBox = new Rectangle((int)position.X, (int)position.Y, texture.Width / 2, texture.Height / 2), BulletPatterns = bulletPatterns }); }
public void spawnCaveMobs() { spawneddd = true; int rooms = finalRooms.Count - 1; if (rooms == 0) { return; } for (int i = 0; i < rooms; i++) { if (i == 0) { // generate boss mayn //spawn boss mayn float rndx; float rndy; do { rndx = UnityEngine.Random.Range(0f, (float)finalRooms[i].roomsize - 1); rndy = UnityEngine.Random.Range(0f, (float)finalRooms[i].roomsize - 1); } while (MapGenerator.Instance.GetTileCollision(finalRooms[i].tiles[(int)rndx].tileX, finalRooms[i].tiles[(int)rndy].tileY)); Vector2 k = new Vector2(finalRooms[i].tiles[(int)rndx].tileX, finalRooms[i].tiles[(int)rndy].tileY); /// te = k; Vector2 zero = (Vector2)MapGenerator.Instance.GetTileGameObject(0, 0).transform.position; int rndBoss = UnityEngine.Random.Range(0, 1); spawnpos.Add(new Vector2(k.x + zero.x, k.y + zero.y)); switch (rndBoss) { case 0: MobsControl.instance.spawnBigWolf(k.x + zero.x, k.y + zero.y); boss = BossTypes.BigWolf; print("boss created wolf"); break; case 1: MobsControl.instance.spawnBigMan(k.x + zero.x, k.y + zero.y); boss = BossTypes.BigMan; print("boss created man"); break; } } float _mobAmount = finalRooms[i].roomsize / 10; int mobAmount = UnityEngine.Random.Range(5, 8); print(mobAmount); mobs += mobAmount; if (mobAmount > 1) { //spawned = true; for (int j = 0; j < mobAmount; j++) { float rndx; float rndy; do { rndx = UnityEngine.Random.Range(0f, (float)finalRooms[i].roomsize - 1); rndy = UnityEngine.Random.Range(0f, (float)finalRooms[i].roomsize - 1); } while (MapGenerator.Instance.GetTileCollision(finalRooms[i].tiles[(int)rndx].tileX, finalRooms[i].tiles[(int)rndy].tileY)); Vector2 k = new Vector2(finalRooms[i].tiles[(int)rndx].tileX, finalRooms[i].tiles[(int)rndy].tileY); //te = k; Vector2 zero = (Vector2)MapGenerator.Instance.GetTileGameObject(0, 0).transform.position; spawnpos.Add(new Vector2(k.x + zero.x, k.y + zero.y)); MobsControl.instance.SpawnBoids(k.x + zero.x, k.y + zero.y, 0, 1); } } } }