示例#1
0
#pragma warning restore 0649
    #endregion

    public void Reset()
    {
        var bulletsShip = GetComponentsInChildren <BulletController>();

        foreach (var item in bulletsShip)
        {
            _pool.Set(item);
        }
    }
    private void MoveProcessing()
    {
        var position       = _bullet.Position;
        var distanceVector = _positionTarget - position;
        var speed          = distanceVector.normalized * (_speed * Time.deltaTime);
        var distanceSqr    = distanceVector.sqrMagnitude;
        var speedSqr       = speed.sqrMagnitude;

        if (speedSqr > distanceSqr)
        {
            position = _positionTarget;
        }
        else
        {
            position += speed;
        }

        _bullet.Position = position;

        if (position == _positionTarget)
        {
            _poolBullets.Set(this);
        }
    }