public override BTResult Execute() { NodePort inPort = GetPort("inResult"); if (inPort != null && inPort.GetConnections().Count != 0) { NodePort connection = inPort.GetConnection(0); if (connection != null) { BTResult result = (BTResult)connection.GetOutputValue(); if (result == BTResult.SUCCESS) { BehaviourTreeRuntimeData.RemoveRunningNode(context, this); } else if (result == BTResult.RUNNING) { return(BTResult.RUNNING); } else { BehaviourTreeRuntimeData.AddRunningNode(context, this); return(BTResult.RUNNING); } } } return(BTResult.SUCCESS); }
public override void OnCreateConnection(NodePort from, NodePort to) { if (to.fieldName == "ValueIn") { if (from.ValueType != value.Type && !value.Type.IsAssignableFrom(from.ValueType)) { return; } if (value != null) { if (from.GetOutputValue() != null) { value.Value = from.GetOutputValue(); } } } }
public override void OnCreateConnection(NodePort from, NodePort to) { base.OnCreateConnection(from, to); if (from.node == this) { nextNode[(int)from.GetOutputValue()].node = (MovesetAttackNode)to.node; } if (to.node == this) { lastNode = (MovesetAttackNode)from.node; } }
void ExecuteExitNode() { NodePort inPort = GetPort("onNodeExit"); if (inPort != null && inPort.GetConnections().Count != 0) { NodePort connection = inPort.GetConnection(0); if (connection != null) { connection.GetOutputValue(); } } }
public override object GetValue(NodePort port) { object o = base.GetValue(port); if (o != null) { return(o); } Bezier3DSpline spline = this.spline; NodePort splineInput = GetInputByFieldName("spline").Connection; if (splineInput != null) { spline = splineInput.GetOutputValue() as Bezier3DSpline; } if (port.fieldName == "length") { if (spline != null) { return(spline.totalLength); } else { return(0); } } else if (port.fieldName == "pointCount") { if (spline != null) { return(spline.KnotCount); } else { return(0); } } else { return(null); } }
public override void OnCreateConnection(NodePort from, NodePort to) { if (to == GetPort("bbGraph") && from.ValueType.IsAssignableFrom(typeof(BlackBoardGraph))) { bbGraph = (BlackBoardGraph)from.GetOutputValue(); foreach (BlackboardObject bbo in bbGraph.BlackboardValues) { if (HasPort(bbo.name)) { //TODO Increment names Debug.Log("Trying to add a port with a variable of the same name."); continue; } else { AddDynamicOutput(bbo.Type, ConnectionType.Multiple, TypeConstraint.InheritedInverse, bbo.name); } } } }