コード例 #1
0
    protected void Shoot(Vector3 startPosition, Vector3 direction)
    {
        if (_poolManager)
        {
            if (_canShoot)
            {
                CannonBallComponent cannonBall = GetCannonBall();

                if (cannonBall)
                {
                    cannonBall.SetUp(startPosition, direction, _damage, _targetName);
                    cannonBall.Throw();

                    _canShoot = false;
                    Invoke("EnableToShoot", _fireRate);
                }
            }
        }
    }
コード例 #2
0
    protected void Shoot(Vector3[] startPositions, Vector3[] directions, int amount)
    {
        if (_poolManager)
        {
            if (_canShoot)
            {
                for (int i = 0; i < amount; i++)
                {
                    CannonBallComponent cannonBall = GetCannonBall();

                    if (cannonBall)
                    {
                        cannonBall.SetUp(startPositions[i], directions[i], _damage, _targetName);
                        cannonBall.Throw();
                    }
                }

                _canShoot = false;
                Invoke("EnableToShoot", _fireRate);
            }
        }
    }