private void FixedUpdate()
 {
     if (sentient != null && sentient.InInteractionRange)
     {
         sentient.Interact();
         return;
     }
     if (movement.CanReceiveInput)
     {
         var seenInteractions = vision?.AllInVision;
         if (canAssignPriorities)
         {
             var priorities = priorityEvaluator?.GetTargetPriorities();
             if (priorities != null)
             {
                 (selectedMovementStrat as IAwareMover).SetPriorities(priorities);
             }
             else
             {
                 //UnityEngine.Debug.LogError($"Assigned smart priorities Strategies move selector, but sentient object has no way to get priorities on {name}");
             }
         }
         if (selectedMovementStrat.GetNextMovement(seenInteractions, transform.position, out var move, out var vec))
         {
             moveDirection = vec;
             movement.RegisterAction(move);
         }
     }
 }
Beispiel #2
0
    public void Interact()
    {
        var priorities = priorityEvaluator?.GetTargetPriorities() ?? defaultInteractionSequence;

        foreach (var pri in priorities)
        {
            if (pri == InteractionType.Food && DoFood())
            {
                UnityEngine.Debug.Log($"<color=#22aa33>{name} do {nameof(DoFood)} - ok</color>");
                return;
            }
            if (pri == InteractionType.Drink && DoDrink())
            {
                UnityEngine.Debug.Log($"<color=#22aa33>{name} do {nameof(DoDrink)} - ok</color>");
                return;
            }
            if (pri == InteractionType.Handsome && DoHandsome())
            {
                UnityEngine.Debug.Log($"<color=#22aa33>{name} do {nameof(DoHandsome)} - ok</color>");
                return;
            }
            if (pri == InteractionType.Strength && DoStrength())
            {
                UnityEngine.Debug.Log($"<color=#22aa33>{name} do {nameof(DoStrength)} - ok</color>");
                return;
            }
            if (pri == InteractionType.Love && DoLove())
            {
                UnityEngine.Debug.Log($"<color=#22aa33>{name} do {nameof(DoLove)} - ok</color>");
                return;
            }
        }
    }