コード例 #1
0
    IEnumerator Shoot()
    {
        if (!_target)
        {
            yield return(null);
        }

        _shooting = true;
        var cg   = CurrentGun;
        var pool = PoolManager.GetObject(bulletSample.name, cg.position, Quaternion.identity);

        if (!pool)
        {
            pool = Instantiate(bulletSample, cg.position, Quaternion.identity);
        }
        pool.GetComponent <BulletController>().SetFields(_target.transform, _stats.BulletSpeed, _stats.Damage);

        _stats.TakeDamage();

        yield return(new WaitForSeconds(shootDelay));

        _shooting = false;
    }