public override void EntityUpdate() { EnemyBehaviour.CheckForTargets(this); if (Target != null) { spawnTimer += Time.deltaTime; if (spawns.Count < maxSpawns && spawnTimer >= spawnCooldown) { EnemyPrototype proto = EnemyDatabase.GetEnemyPrototype(spawnType); Slime temp = new Slime(proto); temp.Spawn(Position + spawnOffset); //EnemyBehaviour.Jump(temp, 120); spawnTimer = 0; temp.nestParent = this; spawns.Add(temp); } } base.EntityUpdate(); }
public Enemy AddEnemyEntity(EnemyData data) { EnemyPrototype proto = EnemyDatabase.GetEnemyPrototype(data.type); if (proto == null) { return(null); } Enemy temp = null; switch (proto.enemyType) { case EnemyType.Slime: temp = new Slime(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Eye: temp = new Eye(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.WurmAlien: temp = new WurmAlien(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Snek: temp = new Snek(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Stag: temp = new Stag(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Snowball: temp = new Snowball(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Sporby: temp = new Sporby(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Voidling: temp = new Voidling(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Ghost: temp = new Ghost(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Snowdrift: temp = new Snowdrift(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Treedude: temp = new Treedude(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.FrogLegs: temp = new FrogLegs(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Hedgehog: temp = new Hedgehog(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Nest: temp = new Nest(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Crawler: temp = new Crawler(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.Nipper: temp = new Nipper(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case EnemyType.PhoenixEgg: temp = new PhoenixEgg(proto); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; } return(temp); }