public void Init(EnemyFlock flock, int id, float healthBonus, float damageBonus, CollisionChecker collisionChecker) { this.flock = flock; flockId = id; this.collisionChecker = collisionChecker; attackDamage += damageBonus; healthComp = new Health(startingHP + (int)healthBonus); }
public void Spawn() { EnemyFlock.Clear(); // populate the flock of enemies for (int i = 0; i < numEnemies; i++) { // calculate a random position around the centroid, assign each enemy a random pos Vector3 randPos = new Vector3(Random.Range(this.transform.position.x - minXSpawn, this.transform.position.x + maxXSpawn), Random.Range(this.transform.position.y - minYSpawn, this.transform.position.y + maxYSpawn), 0); // add an enemy to the flock enemyFlock.Add((GameObject)Instantiate(enemyPrefab, randPos, Quaternion.identity)); //enemyFlock[i].GetComponent<TriangleEnemy>().target = target; //enemyFlock[i].GetComponent<TriangleEnemy>().attackRadius = attackRad; } }