protected VariableDef setParameter(NodeTag.DefaultObject node, string propertyType, string propertyName) { List <ParInfo> allPars = new List <ParInfo>(); ((Nodes.Node)node.Behavior).GetAllPars(ref allPars); if (allPars.Count > 0) { string fullname = string.Format("{0} {1}", propertyType, propertyName); foreach (ParInfo p in allPars) { if (p.ToString() == fullname) { VariableDef v = new VariableDef(p); v.SetValue(p, VariableDef.kPar); return(v); } } } return(null); }
protected VariableDef setParameter(NodeTag.DefaultObject node, string propertyType, string propertyName) { List<ParInfo> allPars = new List<ParInfo>(); ((Nodes.Node)node.Behavior).GetAllPars(ref allPars); if (allPars.Count > 0) { string fullname = string.Format("{0} {1}", propertyType, propertyName); foreach (ParInfo p in allPars) { if (p.ToString() == fullname) { VariableDef v = new VariableDef(p); v.SetValue(p, VariableDef.kPar); return v; } } } return null; }
static public VariableDef setParameter(NodeTag.DefaultObject node, string propertyName) { Behaviac.Design.Nodes.Behavior behavior = node.Behavior as Behaviac.Design.Nodes.Behavior; string instance = Plugin.GetInstanceName(propertyName); if (!string.IsNullOrEmpty(instance)) { propertyName = propertyName.Substring(instance.Length + 1, propertyName.Length - instance.Length - 1); VariableDef var = createVariable(behavior.AgentType, instance, propertyName); if (var != null) { return(var); } } // Try to find the Par parameter with the name. List <ParInfo> allPars = new List <ParInfo>(); ((Nodes.Node)behavior).GetAllPars(ref allPars); if (allPars.Count > 0) { foreach (ParInfo p in allPars) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef var = new VariableDef(p); var.SetValue(p, VariableDef.kPar); return(var); } } } // Try to find the Agent property with the name. if (behavior != null && behavior.AgentType != null) { IList <PropertyDef> properties = behavior.AgentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(new VariableDef(p, VariableDef.kSelf)); } } } // Try to find the World property with the name. string instacneName = Plugin.GetClassName(propertyName); if (!string.IsNullOrEmpty(instacneName) && Plugin.GetInstanceAgentType(instacneName) != null) { IList <PropertyDef> properties = Plugin.GetInstanceAgentType(instacneName).GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(new VariableDef(p, instacneName)); } } } return(null); }
public static VariableDef setParameter(NodeTag.DefaultObject node, string propertyName) { Behaviac.Design.Nodes.Behavior behavior = node.Behavior as Behaviac.Design.Nodes.Behavior; string instance = Plugin.GetInstanceName(propertyName); if (!string.IsNullOrEmpty(instance)) { propertyName = propertyName.Substring(instance.Length + 1, propertyName.Length - instance.Length - 1); VariableDef var = createVariable(behavior.AgentType, instance, propertyName); if (var != null) return var; } // Try to find the Par parameter with the name. List<ParInfo> allPars = new List<ParInfo>(); ((Nodes.Node)behavior).GetAllPars(ref allPars); if (allPars.Count > 0) { foreach (ParInfo p in allPars) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef var = new VariableDef(p); var.SetValue(p, VariableDef.kPar); return var; } } } // Try to find the Agent property with the name. if (behavior != null && behavior.AgentType != null) { IList<PropertyDef> properties = behavior.AgentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) return new VariableDef(p, VariableDef.kSelf); } } // Try to find the World property with the name. string instacneName = Plugin.GetClassName(propertyName); if (!string.IsNullOrEmpty(instacneName) && Plugin.GetInstanceAgentType(instacneName) != null) { IList<PropertyDef> properties = Plugin.GetInstanceAgentType(instacneName).GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) return new VariableDef(p, instacneName); } } return null; }