/// <summary>
 /// Moves the character towards the target if needed
 /// </summary>
 protected virtual void Move()
 {
     if (_brain.Target == null)
     {
         _characterPathfinder3D.SetNewDestination(null);
         return;
     }
     else
     {
         _characterPathfinder3D.SetNewDestination(_brain.Target.transform);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Moves the character towards the target if needed
        /// </summary>
        protected virtual void Move()
        {
            if (_aiActionMovePatrol3D == null)
            {
                return;
            }


            _backToPatrolTransform.position = _aiActionMovePatrol3D.LastReachedPatrolPoint;
            _characterPathfinder3D.SetNewDestination(_backToPatrolTransform);
            _brain.Target = _backToPatrolTransform;
        }
Beispiel #3
0
 /// <summary>
 /// If the mouse is clicked, we cast a ray and if that ray hits the plane we make it the pathfinding target
 /// </summary>
 protected virtual void DetectMouse()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Ray ray = _mainCamera.ScreenPointToRay(Input.mousePosition);
         Debug.DrawRay(ray.origin, ray.direction * 100, Color.yellow);
         float distance;
         if (_playerPlane.Raycast(ray, out distance))
         {
             Vector3 target = ray.GetPoint(distance);
             Destination.transform.position = target;
             _destinationSet = true;
             _characterPathfinder3D.SetNewDestination(Destination.transform);
         }
     }
 }