当前位置: 首页>>代码示例>>C#>>正文


C# BehaviorNode.Clone方法代码示例

本文整理汇总了C#中BehaviorNode.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorNode.Clone方法的具体用法?C# BehaviorNode.Clone怎么用?C# BehaviorNode.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BehaviorNode的用法示例。


在下文中一共展示了BehaviorNode.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetReferenceBehavior

        private void SetReferenceBehavior(BehaviorNode referencedBehavior_) {
            Debug.Check(referencedBehavior_ != null);

            Behavior refTree = null;
            bool bPlanningExpand = this.IsPlanningExpand();

            if (bPlanningExpand) {
                //set it first here as it might recursively point to itself
                //otherwise in the following Clone, referencedBehavior_  will be null
                this._referencedBehavior = referencedBehavior_;

                refTree = (Behavior)referencedBehavior_.Clone();
                refTree.ParentNode = this;
                refTree.PlanningProcess = Plugin.PlanningProcess;

                //TrimForPlanning_(refTree);

            } else {
                Behavior b = referencedBehavior_ as Behavior;
                refTree = new Behavior(b);
            }

            this._referencedBehavior = refTree;

            _referencedBehavior.WasModified += new WasModifiedEventDelegate(referencedBehavior_WasModified);
            _referencedBehavior.WasRenamed += new WasRenamedEventDelegate(referencedBehavior_WasRenamed);

            if (bPlanningExpand) {
                // assign the connector of the behaviour
                _genericChildren = _referencedBehavior.GenericChildren;
                _children.SetConnector(_genericChildren);

                this._planningProcess = Plugin.PlanningProcess;

                ms_expanding++;
                ExpandRefBehavior(refTree);
                ms_expanding--;
            }

            //when expand planning process, don't update _task, as it will be set wrongly
            if (Plugin.EditMode == EditModes.Design) {
                Behavior refTree_ = referencedBehavior_ as Behavior;

                if (refTree_.Children.Count > 0 && refTree_.Children[0] is Task) {
                    Task rootTask = refTree_.Children[0] as Task;
                    this._task = (MethodDef)rootTask.Prototype.Clone();
                }
            }
        }
开发者ID:675492062,项目名称:behaviac,代码行数:49,代码来源:ReferencedBehavior.cs


注:本文中的BehaviorNode.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。