Exemple #1
0
 public Behavior(Behavior otherBehavior)
 {
     Tag        = otherBehavior.Tag;
     Table      = otherBehavior.Table;
     Cycle      = new LifeCycle(otherBehavior.Cycle);
     Properties = new LifeProperties(otherBehavior.Properties);
 }
Exemple #2
0
 public Behavior(BehaviorTag tag)
 {
     Tag        = tag;
     Table      = new ReactionTable();
     Cycle      = new LifeCycle();
     Properties = new LifeProperties();
 }
Exemple #3
0
 private void ValidateStyle(BehaviorTag bt)
 {
     if (IsInExecutionSequence(bt.Container))
     {
         bt.Label.Style = GetStyle(bt.Behavior, bt.Container);
     }
     else
     {
         bt.Label.Style = null;
     }
 }
Exemple #4
0
        private BaseControl CreateNode(Skill.Framework.AI.Behavior behavior, Skill.Framework.AI.BehaviorContainer container)
        {
            BaseControl control = null;

            switch (behavior.Type)
            {
            case Skill.Framework.AI.BehaviorType.Action:
            case Skill.Framework.AI.BehaviorType.Condition:
            case Skill.Framework.AI.BehaviorType.ChangeState:
                Label lbl = new Label();
                lbl.Style        = _FailurStyle;
                lbl.Content.text = behavior.Name;
                BehaviorTag bt = new BehaviorTag(behavior, container, lbl);
                _Behaviors.Add(bt);
                control = lbl;

                if (behavior.Type == Framework.AI.BehaviorType.Action)
                {
                    lbl.Content.image = Resources.UITextures.BTree.Action;
                }
                else if (behavior.Type == Framework.AI.BehaviorType.ChangeState)
                {
                    lbl.Content.image = Resources.UITextures.BTree.ChangeState;
                }
                else if (behavior.Type == Framework.AI.BehaviorType.Condition)
                {
                    lbl.Content.image = Resources.UITextures.BTree.Condition;
                }

                break;

            case Skill.Framework.AI.BehaviorType.Decorator:
            case Skill.Framework.AI.BehaviorType.Composite:

                Skill.Editor.UI.FolderView fw = new UI.FolderView();
                fw.Foldout.Style        = _FailurStyle;
                fw.Foldout.Content.text = behavior.Name;
                fw.Foldout.IsOpen       = true;
                CompositeTag ct = new CompositeTag(behavior, container, fw);
                _Composites.Add(ct);
                control = fw;

                if (behavior.Type == Framework.AI.BehaviorType.Composite)
                {
                    Skill.Framework.AI.Composite composite = (Skill.Framework.AI.Composite)behavior;
                    switch (composite.CompositeType)
                    {
                    case Skill.Framework.AI.CompositeType.Sequence:
                        fw.Foldout.Content.image = Resources.UITextures.BTree.Sequence;
                        break;

                    case Skill.Framework.AI.CompositeType.Concurrent:
                        fw.Foldout.Content.image = Resources.UITextures.BTree.Concurrent;
                        break;

                    case Skill.Framework.AI.CompositeType.Random:
                        fw.Foldout.Content.image = Resources.UITextures.BTree.Random;
                        break;

                    case Skill.Framework.AI.CompositeType.Priority:
                    case Skill.Framework.AI.CompositeType.State:
                        fw.Foldout.Content.image = Resources.UITextures.BTree.Priority;
                        break;

                    case Skill.Framework.AI.CompositeType.Loop:
                        fw.Foldout.Content.image = Resources.UITextures.BTree.Loop;
                        break;
                    }
                }
                else if (behavior.Type == Framework.AI.BehaviorType.Decorator)
                {
                    Skill.Framework.AI.Decorator decorator = (Skill.Framework.AI.Decorator)behavior;
                    switch (decorator.DecoratorType)
                    {
                    case Skill.Framework.AI.DecoratorType.Default:
                        fw.Foldout.Content.image = Resources.UITextures.BTree.Decorator;
                        break;

                    case Skill.Framework.AI.DecoratorType.AccessLimit:
                        fw.Foldout.Content.image = Resources.UITextures.BTree.AccessLimitDecorator;
                        break;
                    }
                }
                break;
            }
            return(control);
        }