public bool btload(Agent.State_t state) { state.Vars.CopyTo(this, this.m_variables); if (state.BT != null) { if (this.m_currentBT != null) { for (int i = 0; i < this.m_behaviorTreeTasks.Count; i++) { BehaviorTreeTask behaviorTreeTask = this.m_behaviorTreeTasks[i]; if (behaviorTreeTask == this.m_currentBT) { Workspace.DestroyBehaviorTreeTask(behaviorTreeTask, this); this.m_behaviorTreeTasks.Remove(behaviorTreeTask); break; } } } BehaviorNode node = state.BT.GetNode(); this.m_currentBT = (BehaviorTreeTask)node.CreateAndInitTask(); state.BT.CopyTo(this.m_currentBT); return(true); } return(false); }
public override void copyto(BehaviorTask target) { base.copyto(target); Debug.Check(target is SingeChildTask); SingeChildTask ttask = target as SingeChildTask; if (this.m_root != null) { //referencebehavior/query, etc. if (ttask.m_root == null) { BehaviorNode pNode = this.m_root.GetNode(); Debug.Check(pNode is BehaviorTree); ttask.m_root = pNode.CreateAndInitTask(); //Debug.Check(ttask.m_root is BehaviorTreeTask); //BehaviorTreeTask btt = ttask.m_root as BehaviorTreeTask; //btt.ModifyId(ttask); } Debug.Check(ttask.m_root != null); this.m_root.copyto(ttask.m_root); } }
public State_t(Agent.State_t c) { c.m_vars.CopyTo(null, this.m_vars); if (c.m_bt != null) { BehaviorNode node = c.m_bt.GetNode(); this.m_bt = (BehaviorTreeTask)node.CreateAndInitTask(); c.m_bt.CopyTo(this.m_bt); } }
public override void Init(BehaviorNode node) { base.Init(node); int childrenCount = node.GetChildrenCount(); for (int i = 0; i < childrenCount; i++) { BehaviorNode child = node.GetChild(i); BehaviorTask pBehavior = child.CreateAndInitTask(); this.addChild(pBehavior); } }
public bool btsave(Agent.State_t state) { this.m_variables.CopyTo(null, state.Vars); if (this.m_currentBT != null) { Workspace.DestroyBehaviorTreeTask(state.BT, this); BehaviorNode node = this.m_currentBT.GetNode(); state.BT = (BehaviorTreeTask)node.CreateAndInitTask(); this.m_currentBT.CopyTo(state.BT); return(true); } return(false); }
public override void Init(BehaviorNode node) { base.Init(node); if (node.GetChildrenCount() == 1) { BehaviorNode child = node.GetChild(0); if (child != null) { BehaviorTask pBehavior = child.CreateAndInitTask(); this.addChild(pBehavior); } } }
public override void Init(BehaviorNode node) { base.Init(node); Debug.Check(node.GetChildrenCount() > 0); int childrenCount = node.GetChildrenCount(); for (int i = 0; i < childrenCount; i++) { BehaviorNode childNode = node.GetChild(i); BehaviorTask childTask = childNode.CreateAndInitTask(); this.addChild(childTask); } }
public override void copyto(BehaviorTask target) { base.copyto(target); SingeChildTask singeChildTask = target as SingeChildTask; if (this.m_root != null) { if (singeChildTask.m_root == null) { BehaviorNode node = this.m_root.GetNode(); singeChildTask.m_root = node.CreateAndInitTask(); } this.m_root.copyto(singeChildTask.m_root); } }
public virtual void Init(BehaviorNode node) { this.m_node = node; this.m_id = this.m_node.GetId(); int attachmentsCount = node.GetAttachmentsCount(); if (attachmentsCount > 0) { for (int i = 0; i < attachmentsCount; i++) { BehaviorNode attachment = node.GetAttachment(i); AttachmentTask pAttachment = (AttachmentTask)attachment.CreateAndInitTask(); this.Attach(pAttachment); } } }
//~SingeChildTask() //{ // m_root = null; //} public override void Init(BehaviorNode node) { base.Init(node); Debug.Check(node.GetChildrenCount() <= 1); if (node.GetChildrenCount() == 1) { BehaviorNode childNode = node.GetChild(0); BehaviorTask childTask = childNode.CreateAndInitTask(); this.addChild(childTask); } else { Debug.Check(true); } }
public virtual void Init(BehaviorNode node) { Debug.Check(node != null); this.m_node = node; this.m_id = this.m_node.GetId(); int attachmentsCount = node.GetAttachmentsCount(); if (attachmentsCount > 0) { for (int i = 0; i < attachmentsCount; i++) { BehaviorNode attachmentNode = node.GetAttachment(i); AttachmentTask attachmentTask = (AttachmentTask)attachmentNode.CreateAndInitTask(); this.Attach(attachmentTask); } } }