Esempio n. 1
0
        private Dictionary <string, L2DModel> _models = new Dictionary <string, L2DModel>(); // <모델정보명, 생성된 모델>

        public L2DModel LoadModel(string modelInfoName)
        {
            L2DModel model = null;

            if (_models.TryGetValue(modelInfoName, out model))
            {
                return(model);
            }

            string    filepath = Define.L2D._modelInfoRoot + "/" + modelInfoName;
            TextAsset infoText = Resources.Load <TextAsset>(filepath);

            if (infoText == null)
            {
                Debug.LogError("'" + modelInfoName + "' ModelInfo does not exist");
                return(null);
            }

            int          slotIdx = RegisterToSlot(modelInfoName);
            L2DModelInfo info    = JsonUtility.FromJson <L2DModelInfo>(infoText.text);

            model = new L2DModel();
            model.Initialize(info, slotIdx);
            model.SetActivate(false);

            _models.Add(modelInfoName, model);
            return(model);
        }