public NodeState Tick(int index, INodeBlob blob, IBlackboard blackboard) { var intVariable = IntBlobVariable.GetData(index, blob, blackboard);// by value //ref var intVariable = IntBlobVariable.GetDataRef(index, blob, blackboard); // by reference return(NodeState.Success); }
public NodeState Tick <TNodeBlob, TBlackboard>(int index, ref TNodeBlob blob, ref TBlackboard bb) where TNodeBlob : struct, INodeBlob where TBlackboard : struct, IBlackboard { DestVariable.GetDataRef(index, ref blob, ref bb) = (int)SrcVariable.GetData(index, ref blob, ref bb); return(NodeState.Success); }
public NodeState Tick(int index, INodeBlob blob, IBlackboard bb) { var input = InputMove.GetData(index, blob, bb); var direction = new Vector3(input.x, 0, input.y).normalized; var speed = Speed.GetData(index, blob, bb); OutputVelocity.GetDataRef(index, blob, bb) = direction * speed; return(NodeState.Success); }
public NodeState Tick <TNodeBlob, TBlackboard>(int index, ref TNodeBlob blob, ref TBlackboard bb) where TNodeBlob : struct, INodeBlob where TBlackboard : struct, IBlackboard { var input = InputMove.GetData(index, ref blob, ref bb); var direction = new Vector3(input.x, 0, input.y).normalized; var speed = Speed.GetData(index, ref blob, ref bb); OutputVelocity.GetDataRef(index, ref blob, ref bb) = direction * speed; return(NodeState.Success); }
public NodeState Tick(int index, INodeBlob blob, IBlackboard bb) { var controller = bb.GetData <CharacterController>(); if (controller == null) { return(NodeState.Failure); } Vector3 velocity = Velocity.GetData(index, blob, bb); controller.SimpleMove(IsLocal ? controller.transform.localToWorldMatrix.MultiplyVector(velocity) : velocity); return(NodeState.Success); }
public NodeState Tick(int index, INodeBlob blob, IBlackboard bb) { var transform = bb.GetData <Transform>(); if (transform == null) { return(NodeState.Failure); } var rotation = RotationProperty.GetData(index, blob, bb); transform.rotation = rotation; return(NodeState.Success); }
public NodeState Tick(int index, INodeBlob blob, IBlackboard bb) { var move = InputMove.GetData(index, blob, bb); if (math.lengthsq(move) <= math.FLT_MIN_NORMAL) { return(NodeState.Success); } var direction = quaternion.LookRotationSafe(new float3(move.x, 0, move.y), math.up()); OutputDirection.GetDataRef(index, blob, bb) = direction; return(NodeState.Success); }
public NodeState Tick <TNodeBlob, TBlackboard>(int index, ref TNodeBlob blob, ref TBlackboard bb) where TNodeBlob : struct, INodeBlob where TBlackboard : struct, IBlackboard { var controller = bb.GetObject <CharacterController>(); if (controller == null) { return(NodeState.Failure); } Vector3 velocity = Velocity.GetData(index, ref blob, ref bb); controller.SimpleMove(IsLocal ? controller.transform.localToWorldMatrix.MultiplyVector(velocity) : velocity); return(NodeState.Success); }
public NodeState Tick <TNodeBlob, TBlackboard>(int index, ref TNodeBlob blob, ref TBlackboard bb) where TNodeBlob : struct, INodeBlob where TBlackboard : struct, IBlackboard { var transform = bb.GetObject <Transform>(); if (transform == null) { return(NodeState.Failure); } var rotation = RotationProperty.GetData(index, ref blob, ref bb); transform.rotation = rotation; return(NodeState.Success); }
public NodeState Tick(int index, INodeBlob blob, IBlackboard bb) { DestVariable.GetDataRef(index, blob, bb) = (int)SrcVariable.GetData(index, blob, bb); return(NodeState.Success); }