root/src/BRAINSFramework/Designer/BehaviorNode.cs

User picture

Author: conkerjo

Revision: 30 («Previous)


File Size: 1.69 KB

(July 08, 2009 19:40 UTC) Almost 3 years ago


  

 
Show/hide line numbers

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Brains.Framework.Designer
{
    /// <summary>
    /// The BehaviorNode class is used to load behaviors from file
    /// </summary>
    /// <remarks>There is no use for this class beyond what the editor provides.</remarks>
    public class BehaviorNode
    {
        private string _typeName = "";
        
        public string Name { get; set; }

        [XmlIgnore()]
        public Type Type { get; set; }

        public string TypeName
        {
            get
            {
                if (Type == null || Type == typeof(System.Type))
                    return _typeName;
                else
                    return Type.FullName;
            }

            set { _typeName = value; }
        }

        public List<Parameter> Parameters { get; set; }

        public List<BehaviorNode> SubBehaviors { get; set; }
        
        public BehaviorNode()
        {
            Parameters = new List<Parameter>();
            SubBehaviors = new List<BehaviorNode>();
        }

        public void AddParameter(string name, string value)
        {
            Parameter p = new Parameter(name, value);
            Parameters.Add(p);
        }

        public string BehaviorName { get; set; }
    }
    
    public class Parameter
    {
        public string Name { get; set; }
        public string Value { get; set; }

        public Parameter()
        {
        }
        
        public Parameter(string name, string value)
        {
            Name = name;
            Value = value;
        }
    }
}