Exemple #1
0
    /// <summary>
    /// Fires a projectile
    /// </summary>
    /// <returns>True if the projectile can be fired, false otherwise</returns>
    public bool Fire()
    {
        if (_coolDownTimer >= CoolDownTime)
        {
            _coolDownTimer = 0;
            Projectile projectile = Projectiles.GetPooledItem();
            if (projectile != null)
            {
                projectile.transform.position = transform.position;
                projectile.transform.rotation = transform.rotation;
                projectile.Launch(this, transform.forward);
                return(true);
            }
        }

        return(false);
    }