public static void RegisterSpace(Transform tr, int mapId, Vector3 offsetPosition, Quaternion offsetRotation, Vector3 offsetScale) { SpaceContainer sc; if (!transformToSpace.ContainsKey(tr)) { sc = new SpaceContainer(); transformToSpace[tr] = sc; } else { sc = transformToSpace[tr]; } sc.mapCount++; MapOffset mo = new MapOffset(); mo.position = offsetPosition; mo.rotation = offsetRotation; mo.scale = offsetScale; mo.space = sc; mapIdToOffset[mapId] = mo; }
static public void UnregisterSpace(Transform tr, int spaceId) { SpaceContainer sc = m_TransformToSpace[tr]; if (--sc.mapCount == 0) { m_TransformToSpace.Remove(tr); } m_MapIdToOffset.Remove(spaceId); }
public static void UnregisterSpace(Transform tr, int spaceId) { if (transformToSpace.ContainsKey(tr)) { SpaceContainer sc = transformToSpace[tr]; if (--sc.mapCount == 0) { transformToSpace.Remove(tr); } if (mapIdToOffset.ContainsKey(spaceId)) { mapIdToOffset.Remove(spaceId); } } }
static public void RegisterSpace(Transform tr, int mapId, Matrix4x4 offset) { SpaceContainer sc; if (!m_TransformToSpace.ContainsKey(tr)) { sc = new SpaceContainer(); m_TransformToSpace[tr] = sc; } else { sc = m_TransformToSpace[tr]; } sc.mapCount++; MapOffset mo = new MapOffset(); mo.offset = offset; mo.space = sc; m_MapIdToOffset[mapId] = mo; }