예제 #1
0
        public override unsafe void DrawEditor(void *data, IBlackboardComponent blackboard)
        {
            var value  = *(int *)data;
            var output = UnityEditor.EditorGUILayout.DelayedIntField(name, value);

            if (value != output)
            {
                MainThreadDispatcher.Schedule(() => blackboard.SetValue(Index, output));
            }
        }
예제 #2
0
        public override unsafe void DrawEditor(void *data, IBlackboardComponent blackboard)
        {
            var value  = *(byte *)data;
            var output = UnityEditor.EditorGUILayout.Toggle(name, (value).ToBoolean()).ToByte();

            if (output != value)
            {
                MainThreadDispatcher.Schedule(() => blackboard.SetValue(Index, output));
            }
        }
예제 #3
0
        public override unsafe void DrawEditor(void *data, IBlackboardComponent blackboard)
        {
            var valuePtr = (float *)data;
            var output   = UnityEditor.EditorGUILayout.Vector3Field(name, new Vector3(valuePtr[0], valuePtr[1], valuePtr[2]));

            // ReSharper disable thrice CompareOfFloatsByEqualityOperator
            if (output.x != valuePtr[0] || output.y != valuePtr[1] || output.z != valuePtr[2])
            {
                MainThreadDispatcher.Schedule(() => blackboard.SetValue(Index, output));
            }
        }
예제 #4
0
        public override unsafe void DrawEditor(void *data, IBlackboardComponent blackboard)
        {
            var value  = *(float *)data;
            var output = UnityEditor.EditorGUILayout.DelayedFloatField(name, value);

            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (output != value)
            {
                MainThreadDispatcher.Schedule(() => blackboard.SetValue(Index, output));
            }
        }
예제 #5
0
    public override ExecutionStatus Execute(float deltaTime)
    {
        ExecutionStatus result;

        if (RandomLocation.TryGet(_locationName, out _current))
        {
            _blackboard.SetValue <Vector3>(_key, _current.transform.position);
            result = ExecutionStatus.Succeeded;
        }
        else
        {
            result = ExecutionStatus.Failed;
        }

        _blackboard = null;

        return(result);
    }
예제 #6
0
 public void ApplyTo(IBlackboardComponent blackboard) => blackboard.SetValue <byte>(key.Index, (byte)(1 - blackboard.GetValue <byte>(key.Index)));
예제 #7
0
 public void ApplyTo(IBlackboardComponent blackboard)
 {
     blackboard.SetValue <float>(key.Index, value.x);
     blackboard.SetValue <float>((ushort)(key.Index + sizeof(float)), value.y);
     blackboard.SetValue <float>((ushort)(key.Index + sizeof(float) + sizeof(float)), value.z);
 }
예제 #8
0
 public void ApplyTo(IBlackboardComponent blackboard) =>
 blackboard.SetValue <int>(key.Index, blackboard.GetValue <int>(key.Index) + blackboard.GetValue <int>(toAdd.Index));
예제 #9
0
 public void ApplyTo(IBlackboardComponent blackboard) => blackboard.SetValue <byte>(key.Index, value.ToByte());