Beispiel #1
0
        public void MoveTo(MoveToTransformOrPosition target, float distance = 0)
        {
            _agent.enabled = true;
            _moveToFailed  = false;

            if (!_agent.isOnNavMesh)
            {
                return;
            }

            var targetPosition = target.GetWorldPosition();

            if (!FindTargetPosition(targetPosition, distance, out targetPosition))
            {
                _agent.enabled = false;
                _moveToFailed  = true;
                return;
            }

            _targetDistance    = distance;
            _agent.destination = targetPosition;
            _agent.isStopped   = false;

            _moveTarget = target;
        }
 public void Disable()
 {
     _target     = null;
     _velocity   = Vector3.zero;
     _hasArrived = false;
 }
 public void StopMoving()
 {
     _target     = null;
     _velocity   = Vector3.zero;
     _hasArrived = false;
 }
 public void MoveTo(MoveToTransformOrPosition target, float distance = 0)
 {
     _target         = target;
     _targetDistance = distance;
     _hasArrived     = false;
 }
Beispiel #5
0
 public MoveToOperand(MoveToTransformOrPosition target, float targetDistance = 0)
 {
     _target         = target;
     _targetDistance = targetDistance;
 }