private void SpawnEntity(Formation formation, ColorPicker color) { GameObject spawn = formation.GetEntity(); Vector3 start = formation.transform.position; start.y = spawnHeight; if (color >= ColorPicker.LEFT && color <= ColorPicker.RIGHT) { switch (color) { case ColorPicker.LEFT: start.x = -3; break; case ColorPicker.MLEFT: start.x = -1; break; case ColorPicker.MRIGHT: start.x = 1; break; case ColorPicker.RIGHT: start.x = 3; break; } } GameObject obj = Instantiate(spawn, start, spawn.transform.rotation) as GameObject; obj.transform.parent = this.transform; AEnemy enemy = obj.GetComponent <AEnemy>(); enemy.Init(hero, levels[level].speed, speedModifier, bonusManager.GetRandomBonus(), ColorPickerToColor(color)); }