using UnityEditor; using UnityEngine; // Base class for Build method fo // - SceneChestManager // - SceneEquippableItemManager public abstract class SceneDataListManager : DataListManager { private readonly string gameObjectLocalization; private readonly string assetLocalization; protected SceneDataListManager(string gameObjectLocalization, string assetLocalization) { this.gameObjectLocalization = gameObjectLocalization; this.assetLocalization = assetLocalization; } // public override void Build() // { // foreach(var prefabAsset in Elements) // { // // GameObject newObject = (GameObject)AssetDatabase.LoadAssetAtPath(gameObjectLocalization + prefabAsset.prefarbAssetName + ".prefab", typeof(GameObject)); // // if(!newObject) // { // Debug.Log("Can't find prefarb by name " + prefabAsset.prefarbAssetName); // break; // } // // // GameObject globalGUI = GameObject.FindGameObjectsWithTag("GUI")[0]; // // if(globalGUI) // { // // 1. Create gameObject by handled prefab // // 2. SetUp // // 2.1 Set position // GameObject _object = Instantiate(newObject, prefabAsset.position, Quaternion.identity, globalGUI.transform); // // // 2.2 Set name // _object.name = prefabAsset.name; // // //chest.transform.SetParent(globalGUI.transform); // // 2.3 Set pransform // _object.transform.localScale = new Vector3(0.5f, 0.5f, 1); // // // doBuild(_object); // // // 3. SetUp EqippableItems list // // Dictionary itemsOfChestList = prefabAsset.content; // // // // string[] assetNames = AssetDatabase.FindAssets("t:EquippableItem", new[] { assetLocalization }); // // // // foreach(KeyValuePair itemsOfChestEntry in itemsOfChestList) // // { // // // 3.1 find object // // foreach (string SOName in assetNames) // // { // // var SOpath = AssetDatabase.GUIDToAssetPath(SOName); // // // // if(SOpath.Contains(itemsOfChestEntry.Value.prefarbAssetName + ".asset")) // // { // // // 3.2 set EquippableItem object // // chest.GetComponent().SetupItemInChest( // // itemsOfChestEntry.Key, // // AssetDatabase.LoadAssetAtPath(SOpath) // // ); // // // // break; // // } // // } // // } // // // // // } else { // Debug.LogError("Can't find global GUI object!!!"); // break; // } // } // } protected abstract void doBuild(GameObject _object); }