Projectile Fire() { if (chargeLevel < 0 || chargeLevel >= projectiles.Length) { return(null); } GameObject projectilePrefab = projectiles[chargeLevel]; if (projectilePrefab == null) { return(null); } GameObject go = PoolController.Activate(projectilePrefab, transform.position, transform.rotation); if (go != null) { // Successfully shot!!! energy = 0; chargeTimer.SetTime(chargeDelay); isCharging = false; AudioController.Instance.PlayOneShot(fireClip); return(go.GetComponent <Projectile>()); } else { return(null); } }
GameObject ShootAtPlayer() { GameObject spawnedObject = PoolController.Activate(objectToSpawn, transform.position, transform.rotation); Unit spawnedUnit = spawnedObject.GetComponent <Unit>(); spawnedUnit.TurnThisTowards(Player.Instance.transform.position); return(spawnedObject); }
public virtual GameObject Spawn(Quaternion spawnRotation) { Unit _unit = objectToSpawn.GetComponent <Unit>(); if (_unit != null) { return(PoolController.Activate(objectToSpawn, transform.position, spawnRotation)); } else { Debug.LogError("[UnitSpawner] objectToSpawn is not a Unit!"); return(null); } }
GameObject ShootForward() { GameObject spawnedObject = PoolController.Activate(objectToSpawn, transform.position, transform.rotation); return(spawnedObject); }
public static void Instantiate(GameObject prefab, Vector3 position, Quaternion rotation) { PoolController.Activate(prefab, position, rotation); }