public GoapWorldState(int id, string name, WorldStateOperator op, object value) { ID = id; Name = name; Operator = op; Value = value; }
public GoapWorldState ParseWorldState(IDataReader reader) { int c_id = reader.GetInt32(0); string c_desc = reader.GetString(1); bool isBool = (reader.GetInt32(2) == 1); WorldStateOperator op = (WorldStateOperator)Enum.Parse(typeof(WorldStateOperator), reader.GetString(5)); bool valBool = (reader.GetInt32(6) == 1); float valFloat = reader.GetFloat(6); object value; if (isBool) { value = valBool; } else { value = valFloat; } GoapWorldState state = new GoapWorldState(c_id, c_desc, op, value); return(state); }