private void LaunchStationPooler(Pooling_Engine pooler, GameObject launchStation) { if (launchStations != null) { launchStations.Clear(); } launchStations = pooler.ObjectsPool(launchStation, new Vector3(0f, -20f, 0f), numOfLaunchStations, launchStationName); GameObject launchStationParent = new GameObject { name = "LaunchStations" }; launchStationParent.transform.SetParent(this.transform); launchStationParent.transform.position = new Vector3(0f, -20f, 0f); for (int i = 0; i < numOfLaunchStations; i++) { launchStations[i].transform.SetParent(launchStationParent.transform); if (i == 0) { launchStations[i].transform.position = new Vector3(-5f, 1f, 0); } else { launchStations[i].transform.position = new Vector3(5f, 1f, 0); } launchStations[i].SetActive(true); } }
void Start() { pooler = GetComponent <Pooling_Engine>(); GameObject explosion = Resources.Load <GameObject>("Prefabs/ExplosionPrefab"); explosionsTypeA = pooler.PoolObjects(explosionsTypeA, explosion, this.gameObject, numOfPooledExplosionsTypeA, "ExplosionTypeA", "Explosions"); gameObject.SetActive(false); }
void Start() { pooler = GetComponent <Pooling_Engine>(); GameObject missile = Resources.Load <GameObject>("Prefabs/EnemyMissilePrefab"); missiles = pooler.PoolObjects(missiles, missile, this.gameObject, numOfPooledMissiles, missileName, "Missiles"); gameObject.SetActive(false); }
void Start() { playerReady = false; pooler = GetComponent <Pooling_Engine>(); GameObject missile = Resources.Load <GameObject>("Prefabs/PlayerMissilePrefab"); GameObject launchStation = Resources.Load <GameObject>("Prefabs/LaunchStationPrefab"); missiles = pooler.PoolObjects(missiles, missile, this.gameObject, numOfPooledMissiles, missileName, "Missiles"); LaunchStationPooler(pooler, launchStation); playerReady = true; return; }