Пример #1
0
        protected override IEnumerator NavAgentTaskRoutine(NavMeshAgent navAgent)
        {
            if (Blackboard.TryGetValue(_destination, out object destinationValue))
            {
                Vector3?destination = null;

                if (destinationValue is Vector3 vectorValue)
                {
                    destination = vectorValue;
                }
                else if (destinationValue is GameObject gObject)
                {
                    destination = gObject.transform.position;
                }
                else if (destinationValue is Component component)
                {
                    destination = component.transform.position;
                }

                if (destination.HasValue)
                {
                    navAgent.SetDestination(destination.Value);

                    if (_waitForFinished)
                    {
                        yield return(new WaitUntil(() => IsReachedDestination(navAgent)));
                    }
                }
            }

            yield return(null);
        }
Пример #2
0
 public object GetWithDefault(Blackboard blackboard)
 {
     if (blackboard.TryGetValue(Name, out var value))
     {
         return(value);
     }
     else
     {
         return(default);
Пример #3
0
        protected override string GetLogString()
        {
            if (Blackboard.TryGetValue(_name, out var value))
            {
                if (value is Object uObject)
                {
                    return(uObject != null ? uObject.name : "null");
                }
                else
                {
                    return(value != null?value.ToString() : "null");
                }
            }

            return($"No value with name '{_name}'");
        }
Пример #4
0
 public bool TryGetValue <T>(Blackboard blackboard, out T value)
 {
     return(blackboard.TryGetValue <T>(Name, out value));
 }
Пример #5
0
 public bool TryGetValue(Blackboard blackboard, out object value)
 {
     return(blackboard.TryGetValue(Name, out value));
 }