コード例 #1
0
 protected EditorComponent(EditorDomain domain, EditorComponent parent, string id)
     : base(id)
 {
     Domain   = domain;
     Parent   = parent;
     Children = new List <EditorComponent>();
 }
コード例 #2
0
ファイル: TaskNode.cs プロジェクト: kangtachan/BehaveAsSakura
        protected TaskNode(EditorDomain domain, EditorComponent parent, TaskState task)
            : base(domain
                   , parent
                   , string.Format("{0}-Node", task.Id))
        {
            Task = task;
            Task.OnEventApplied += Task_OnEventApplied;

            if (task.Desc is DecoratorTaskDescWrapper)
            {
                var desc = (DecoratorTaskDescWrapper)task.Desc;

                if (desc.ChildTaskId > 0)
                {
                    CreateChildTaskNode(desc.ChildTaskId);
                }
            }
            else if (task.Desc is CompositeTaskDescWrapper)
            {
                var desc = (CompositeTaskDescWrapper)task.Desc;

                foreach (var id in desc.ChildTaskIds)
                {
                    CreateChildTaskNode(id);
                }
            }
        }
コード例 #3
0
        private BehaviorTreeView FindRootView()
        {
            for (EditorComponent e = this; e != null; e = e.Parent)
            {
                if (e is BehaviorTreeView)
                {
                    return((BehaviorTreeView)e);
                }
            }

            throw new InvalidOperationException("Failed to find root view");
        }
コード例 #4
0
        public PropertyGroup(EditorDomain domain, EditorComponent parent, Type valueType, object value)
            : base(domain
                   , parent
                   , string.Format("{0}-{1}", typeof(PropertyGroup).Name, Guid.NewGuid().ToString()))
        {
            ValueType = valueType;
            Value     = value;

            properties = (from p in ValueType.GetProperties(BindingFlags.Public | BindingFlags.Instance)
                          where p.GetCustomAttributes(typeof(BehaveAsFieldAttribute), true).Length > 0
                          select Tuple.Create(CreateItem(EditorHelper.GetPropertyName(p), p.PropertyType, p.GetValue(value, null)), p) into t
                          where t.Item2 != null
                          select t).ToArray();
        }
コード例 #5
0
ファイル: TaskNode.cs プロジェクト: kangtachan/BehaveAsSakura
 public static TaskNode Create(EditorComponent parent, TaskState state)
 {
     if (state.Desc is LeafTaskDescWrapper)
     {
         return(new LeafTaskNode(parent.Domain, parent, state));
     }
     else if (state.Desc is DecoratorTaskDescWrapper)
     {
         return(new DecoratorTaskNode(parent.Domain, parent, state));
     }
     else if (state.Desc is CompositeTaskDescWrapper)
     {
         return(new CompositeTaskNode(parent.Domain, parent, state));
     }
     else
     {
         throw new NotSupportedException(state.Desc.ToString());
     }
 }
コード例 #6
0
 public DecoratorTaskNode(EditorDomain domain, EditorComponent parent, TaskState task)
     : base(domain, parent, task)
 {
 }
コード例 #7
0
        //public string Title { get; protected set; }

        //public Vector2 Position { get; protected set; }

        //public Vector2 Size { get; protected set; }

        //public GUIStyle Style { get; protected set; }

        protected Node(EditorDomain domain, EditorComponent parent, string id)
            : base(domain, parent, id)
        {
            RootView = FindRootView();
        }
コード例 #8
0
 public CompositeTaskNode(EditorDomain domain, EditorComponent parent, TaskState task)
     : base(domain, parent, task)
 {
 }