private bool SpawnEnemy(int index, Vector3 castOrigin)
{
bool spawned = false;
RaycastHit hit;
if(Physics.Raycast(castOrigin, -Vector3.up, out hit, this.collider.bounds.extents.z, 1 << this.layerMask.value))
{
// check if not a spawn zone
if(!GameHandler.WithinNoSpawn(hit.point))
{
Enemy enemy = DataHolder.Enemies().GetCopy(this.enemyID[index]);
enemy.Init();
enemy.SetBaseSpawner(this);
GameObject obj = enemy.CreatePrefabInstance();
if(obj != null)
{
obj.transform.position = hit.point+this.spawnOffset[index];
DataHolder.BattleSystem().AddEnemy(enemy);
this.spawnedQuantity[index]++;
}
spawned = true;
}
}
return spawned;
}