protected EditorComponent(EditorDomain domain, EditorComponent parent, string id) : base(id) { Domain = domain; Parent = parent; Children = new List <EditorComponent>(); }
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); } } }
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"); }
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(); }
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()); } }
public DecoratorTaskNode(EditorDomain domain, EditorComponent parent, TaskState task) : base(domain, parent, task) { }
//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(); }
public CompositeTaskNode(EditorDomain domain, EditorComponent parent, TaskState task) : base(domain, parent, task) { }