Ejemplo n.º 1
0
    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);
        }
    }
Ejemplo n.º 2
0
    GameObject ShootAtPlayer()
    {
        GameObject spawnedObject = PoolController.Activate(objectToSpawn, transform.position, transform.rotation);
        Unit       spawnedUnit   = spawnedObject.GetComponent <Unit>();

        spawnedUnit.TurnThisTowards(Player.Instance.transform.position);
        return(spawnedObject);
    }
Ejemplo n.º 3
0
    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);
        }
    }
Ejemplo n.º 4
0
    GameObject ShootForward()
    {
        GameObject spawnedObject = PoolController.Activate(objectToSpawn, transform.position, transform.rotation);

        return(spawnedObject);
    }
Ejemplo n.º 5
0
 public static void Instantiate(GameObject prefab, Vector3 position, Quaternion rotation)
 {
     PoolController.Activate(prefab, position, rotation);
 }