コード例 #1
0
ファイル: Loader.cs プロジェクト: SilentGamzee/Evolo.Mine
        public static GameObject GetError()
        {
            var path = LuaNpcGetter.GetNpcModelById(GetErrorIndex());

            Debug.Log("Error path = " + path);
            return(LoadPrefab(PrefabPath + path));
        }
コード例 #2
0
ファイル: Loader.cs プロジェクト: SilentGamzee/Evolo.Mine
        public static GameObject GetPrefabByIndex(int index)
        {
            //Debug.Log("Getting index: " + index);
            if (PrefabList.ContainsKey(index) && PrefabList[index] != null)
            {
                return(PrefabList[index]);
            }

            var path = LuaNpcGetter.GetNpcModelById(index);

            if (string.IsNullOrEmpty(path))
            {
                Debug.LogError("Loading prefab error. Cant find path. Model id: " + index);
                return(GetError());
            }
            var prefab = LoadPrefab(PrefabPath + path);

            PrefabList.Add(index, prefab);
            return(prefab);
        }