public static GameObject CreateLevelEditorObject(MapHolderType type) { GameObject levelGo = null; string assetPath = ""; switch (type) { case MapHolderType.Barrier: assetPath = AssetUtility.GetLevelObjectAsset(BarrierAsset); break; case MapHolderType.Portal: assetPath = AssetUtility.GetLevelObjectAsset(PortalAsset); break; case MapHolderType.MineGroup: assetPath = AssetUtility.GetLevelObjectAsset(MineAsset); break; } #if UNITY_EDITOR Object asset = AssetDatabase.LoadMainAssetAtPath(assetPath); GameObject portalPrefab = asset as GameObject; levelGo = Instantiate(portalPrefab); #endif return(levelGo); }
public LevelElement GetHolder(MapHolderType type) { LevelElement holder = null; m_Holders.TryGetValue(type, out holder); return(holder); }
public void AddHolder <T>(MapHolderType type) where T : LevelElement { LevelElement holder = null; m_Holders.TryGetValue(type, out holder); if (holder == null) { holder = new GameObject(typeof(T).Name).AddComponent <T>(); m_Holders[type] = holder; } }