public void Instantiate(Property property_, object value) { Debug.Check(property_ != null); uint varId = property_.GetVariableId(); if (!this.m_variables.ContainsKey(varId)) { IVariable pVar = new IVariable(null, property_); behaviac.Debug.Check(pVar != null); pVar.SetValue(value, null); m_variables[varId] = pVar; } else { IVariable pVar = this.m_variables[varId]; Debug.Check(pVar.m_instantiated < 255, "dead loop?!"); //don't update it, so the par set by outer scope can override the one in the internal if (pVar.m_instantiated == 0) { pVar.SetProperty(property_); } else { Debug.Check((property_.GetValue(null) == null && pVar.GetValue(null).GetType().IsSubclassOf(typeof(Agent))) || pVar.GetValue(null).GetType() == property_.GetValue(null).GetType(), "the same name par doesn't have the same type"); } //use the original value, don't update it pVar.m_instantiated++; } }
public void SetProperty(Property p) { if (p != null) { Debug.Check(this.m_name == p.GetVariableName()); Debug.Check(this.m_id == p.GetVariableId()); } this.m_property = p; }
public void Instantiate(Property property_, object value) { uint variableId = property_.GetVariableId(); IVariable variable = null; if (!this.m_variables.TryGetValue(variableId, out variable)) { variable = new IVariable(null, property_); variable.SetValue(value, null); this.m_variables.Add(variableId, variable); } else { if (variable.m_instantiated == 0) { variable.SetProperty(property_); } variable.m_instantiated = (byte)(variable.m_instantiated + 1); } }
public void Instantiate(Property property_, object value) { Debug.Check(property_ != null); //string varirableName = property_.GetVariableName(); //if (varirableName == "TempTargetEnemy") //{ // Debug.Check(true); //} uint varId = property_.GetVariableId(); if (!this.m_variables.ContainsKey(varId)) { IVariable pVar = new IVariable(null, property_); behaviac.Debug.Check(pVar != null); pVar.SetValue(value, null); m_variables[varId] = pVar; } else { IVariable pVar = this.m_variables[varId]; Debug.Check(pVar.m_instantiated < 255, "dead loop?!"); //don't update it, so the par set by outer scope can override the one in the internal if (pVar.m_instantiated == 0) { pVar.SetProperty(property_); } else { Debug.Check(pVar.GetValue(null) == null || (property_.GetValue(null) == null && Utils.IsNullValueType(pVar.GetValue(null).GetType())) || pVar.GetValue(null).GetType() == property_.GetValue(null).GetType(), "the same name par doesn't have the same type"); } //use the original value, don't update it pVar.m_instantiated++; } }