using UnityEngine; using System.Collections.Generic; namespace Octopus.Simulator { public class LogicMappingDataBase : MonoBehaviour { static Dictionary mappingObjectDict = new Dictionary(); public static void SetMapping(string name, SimulationModel target) { if (mappingObjectDict.ContainsKey(name)) { if (target) { mappingObjectDict[name] = target; target.nodeID = name; } else { mappingObjectDict[name].nodeID = ""; mappingObjectDict.Remove(name); } } else { mappingObjectDict.Add(name, target); target.nodeID = name; } } public static SimulationModel GetGameObject(string name) { if (mappingObjectDict.ContainsKey(name)) { return mappingObjectDict[name]; } else { return null; } } public static void LoadDataBase(Dictionary db) { mappingObjectDict = db; } } }