//将XBTNodeMono转换成XBTNode public static XBTNode ParseMono(XBTNodeMono mono, XBTNode parent = null) { var node = new XBTNode(); node.parent = parent; node.taskClassName = mono.className; var variables = mono.GetComponent <XMonoVariables>(); if (variables != null) { node.variables = XMonoVariableUtility.ConvertToDict(variables.values); } var trans = mono.transform; int count = trans.childCount; if (count > 0) { node.children = new List <XBTNode>(); for (int i = 0; i < count; ++i) { var child = trans.GetChild(i).GetComponent <XBTNodeMono>(); if (child == null) { continue; } node.children.Add(ParseMono(child, node)); } } return(node); }
public void Stop(object obj) { if (m_node == null) { return; } if (m_status == EnumTaskStatus.Running) { m_task.Leave(obj); } XBTClassFactory.Free(m_task); m_task = null; m_node = null; m_status = EnumTaskStatus.None; }
public void Start(XBTNode node, object obj) { if (m_status == EnumTaskStatus.Running) { m_task.Leave(obj); } if (m_node == null || m_node != node) { if (m_task != null) { XBTClassFactory.Free(m_task); m_task = null; } m_task = XBTClassFactory.Alloc <IXBTTask>(node.taskClassName); m_task.SetNode(node); m_node = node; } m_task.Enter(obj); m_status = EnumTaskStatus.Running; }
public virtual void SetNode(XBTNode node) { m_node = node; }
public XBTBehavior() { m_node = null; m_task = null; m_status = EnumTaskStatus.None; }