예제 #1
0
        public static NodeState Tick(int index, INodeBlob blob, IBlackboard blackboard)
        {
            var animator = blackboard.GetData <Animator>();

            animator.SetTrigger(blob.GetNodeData <SetAnimatorTriggerNode>(index).Value);
            return(NodeState.Success);
        }
예제 #2
0
        public static NodeState Tick(int index, INodeBlob blob, IBlackboard blackboard)
        {
            var data  = blob.GetNodeData <Data>(index);
            var state = data.A == 0 ? NodeState.Failure : NodeState.Success;

            Debug.Log($"[A]: tick {index} {state}");
            return(state);
        }
예제 #3
0
        public static NodeState Tick(int index, INodeBlob blob, IBlackboard __)
        {
            var data  = blob.GetNodeData <NodeB>(index);
            var state = data.B == data.BB ? NodeState.Success : NodeState.Failure;

            Debug.Log($"[B]: tick {index} {state}");
            return(state);
        }
예제 #4
0
        public static NodeState Tick(int index, INodeBlob blob, IBlackboard bb)
        {
            var input  = bb.GetData <InputActionAssetComponent>().Value;
            var data   = blob.GetNodeData <CheckInputActionPhaseNode>(index);
            var action = input.FindAction(data.ActionId);

            return(action != null && action.phase == data.Phase ? NodeState.Success : NodeState.Failure);
        }
        public static InputAction GetInputAction <TNodeData>(this IBlackboard bb, int index, INodeBlob blob)
            where TNodeData : struct, IInputActionNodeData
        {
            var input = bb.GetData <InputActionAssetComponent>().Value;
            var data  = blob.GetNodeData <TNodeData>(index);

            return(input.FindAction(data.ActionId));
        }
        public static NodeState Tick(int index, INodeBlob blob, IBlackboard bb)
        {
            var input     = bb.GetData <BTInputMoveData>();
            var direction = new Vector3(input.Value.x, 0, input.Value.y).normalized;
            var speed     = blob.GetNodeData <InputMoveToCharacterVelocityNode>(index).Speed;

            bb.GetDataRef <BTCharacterSimpleMoveVelocity>().Value = direction * speed;
            return(NodeState.Success);
        }
예제 #7
0
        public static NodeState Tick(int index, INodeBlob blob, IBlackboard bb)
        {
            var controller = bb.GetData <UnityEngine.CharacterController>();

            if (controller == null)
            {
                return(NodeState.Failure);
            }
            controller.SimpleMove(blob.GetNodeData <CharacterSimpleMoveWithCustomGlobalVelocityNode>(index).Velocity);
            return(NodeState.Success);
        }
예제 #8
0
        public static NodeState Tick(int index, INodeBlob blob, IBlackboard bb)
        {
            var controller = bb.GetData <CharacterController>();

            if (controller == null)
            {
                return(NodeState.Failure);
            }
            var velocity = blob.GetNodeData <CharacterSimpleMoveWithCustomLocalVelocityNode>(index).Velocity;

            velocity = controller.transform.localToWorldMatrix.MultiplyVector(velocity);
            controller.SimpleMove(velocity);
            return(NodeState.Success);
        }