示例#1
0
    private void Update()
    {
        var direction = pivotPosition - transform.position;

        if (_freeX)
        {
            direction.x = 0;
        }

        if (direction.sqrMagnitude > 0)
        {
            direction.Normalize();

            _movementController.AddVelocity(direction * force * Time.deltaTime);
        }

        _lineRendererPoints[0] = pivotPosition;
        if (_freeX)
        {
            _lineRendererPoints[0].x = transform.position.x;
        }
        _lineRendererPoints[1] = transform.position;
        _lineRenderer.SetPositions(_lineRendererPoints);
    }
示例#2
0
 private void OnShoot(ShotData shotData)
 {
     _movement.AddVelocity(-shotData.Velocity * recoilRatio);
 }