public void SaveToBlackboard(MyStringId id, MyBBMemoryValue value) { if (id != MyStringId.NullOrEmpty) { this.m_blackboardMemory[id] = value; } }
private void LoadActionParams(BotActionDesc action, object[] args, MyPerTreeBotMemory botMemory) { for (int i = 0; i < args.Length; i++) { var arg = args[i]; if (arg is Boxed <MyStringId> && action.ParametersDesc.ContainsKey(i)) { var parameterDesc = action.ParametersDesc[i]; Boxed <MyStringId> stringId = arg as Boxed <MyStringId>; MyBBMemoryValue value = null; if (botMemory.TryGetFromBlackboard(stringId, out value)) { if (value == null || value.GetType() == parameterDesc.Item1) { action.ActionParams[i] = value; } else { Debug.Assert(false, "Mismatch of types in the blackboard. Did you use a wrong identifier?"); action.ActionParams[i] = null; } } } else { action.ActionParams[i] = arg; } } }
public void SaveToBlackboard(MyStringId id, MyBBMemoryValue value) { Debug.Assert(id != MyStringId.NullOrEmpty, "Empty id for memory."); if (id != MyStringId.NullOrEmpty) { m_blackboardMemory[id] = value; } }
public bool TryGetFromBlackboard <T>(MyStringId id, out T value) where T : MyBBMemoryValue { MyBBMemoryValue value2 = null; bool flag1 = this.m_blackboardMemory.TryGetValue(id, out value2); value = value2 as T; return(flag1); }
public bool TryGetFromBlackboard <T>(MyStringId id, out T value) where T : MyBBMemoryValue { MyBBMemoryValue output = null; bool found = m_blackboardMemory.TryGetValue(id, out output); value = output as T; return(found); }
public MyBBMemoryValue TrySaveToBlackboard(MyStringId id, Type type) { if (!type.IsSubclassOf(typeof(MyBBMemoryValue)) && (type != typeof(MyBBMemoryValue))) { return(null); } if (type.GetConstructor(Type.EmptyTypes) == null) { return(null); } MyBBMemoryValue value2 = Activator.CreateInstance(type) as MyBBMemoryValue; this.m_blackboardMemory[id] = value2; return(value2); }
public void AddBlackboardMemoryInstance(string name, MyBBMemoryValue obj) { MyStringId stringId = MyStringId.GetOrCompute(name); m_blackboardMemory.Add(stringId, obj); }
public void AddBlackboardMemoryInstance(string name, MyBBMemoryValue obj) { MyStringId orCompute = MyStringId.GetOrCompute(name); this.m_blackboardMemory.Add(orCompute, obj); }