private void Awake() { activeObjects.Clear(); pooling = gameObject.GetComponentInParent <EnemyPooling>(); currentSpawnpoint.y = transform.position.y; spawnState = SPAWNSTATE.WAITING; }
//Spawns an enemy on the given spawnpoint, removes spawned enemie from the pool //adds enemy to a list of active objects. private void SpawnEnemy(Vector3 _spawnPoint) { spawnState = SPAWNSTATE.SPAWNING; GameObject spawnedObject = pooling.poolsDictionairy[poolType][0]; spawnedObject.transform.position = _spawnPoint; spawnedObject.SetActive(true); activeObjects.Add(spawnedObject); pooling.poolsDictionairy[poolType].Remove(spawnedObject); spawnState = SPAWNSTATE.WAITING; }