public virtual void OnLinkTo(LogicNodeBase node) { if (!Link.Contains(node) && node != this) { Link.Add(node); } }
public static LogicNodeBase Create(LogicObject obj, Vector2 pos, Type type) { LogicNodeBase nb = ScriptableObject.CreateInstance(type) as LogicNodeBase; nb.Pos = pos; nb.CurrentLogicObject = obj; return(nb); }
protected bool ValueMatch <T>(LogicNodeBase node, ref T t) where T : LogicNodeBase { bool isMatch = node is T; if (isMatch) { t = node as T; } return(isMatch); }
void OnEnable() { #if UNITY_EDITOR if (DefaultNode == null) { DefaultNode = ScriptableObject.CreateInstance <StartNode>(); } DefaultNode.IsDefault = true; DefaultNode.DefaultColor = Color.green; #endif }
public void DrawArrowTo(LogicNodeBase node) { float rTheta = Mathf.PI / 6.0f; float cosTheta = Mathf.Cos(rTheta); float sinTheta = Mathf.Sin(rTheta); float len = 10.0f; float len2 = 0.5f * len; Vector2 dir = (node.Pos - this.Pos).normalized; Vector2 mid = (node.Pos + this.Pos) / 2f; Vector2 q1 = mid - len * new Vector2(dir.x * cosTheta - dir.y * sinTheta, dir.x * sinTheta + dir.y * cosTheta); Vector2 q2 = mid - len * new Vector2(dir.x * cosTheta + dir.y * sinTheta, -dir.x * sinTheta + dir.y * cosTheta); Vector2 q3 = mid - dir * len2; Handles.DrawLine(mid, q1); Handles.DrawLine(mid, q2); Handles.DrawLine(q1, q3); Handles.DrawLine(q2, q3); Handles.DrawLine(this.Pos, node.Pos); }
public virtual bool CanLinkTo(LogicNodeBase node) { return(true); }