/** 构造单位加载列表 */ protected virtual void makeUnitLoadList(IntSet loadList, UnitInfoData data) { if (BaseC.constlist.unit_canFight(data.identity.type)) { int fightUnitID; if ((fightUnitID = ((FightUnitIdentityData)data.identity).getFightUnitID()) > 0) { int modelID; if ((modelID = FightUnitConfig.get(fightUnitID).modelID) > 0) { loadList.add(ModelConfig.get(modelID).sourceT); } } } switch (data.identity.type) { case UnitType.Character: { } break; } }
/** 设置显示模型 */ public void setModel(int modelID) { if (_showModelID == modelID) { return; } _showModelID = modelID; _modelConfig = ModelConfig.get(modelID); loadModel(); }
/** 更新模型 */ protected virtual void onRefreshModel(int modelID) { if (modelID > 0) { _modelConfig = ModelConfig.get(modelID); _collideRadius = _modelConfig.collideRadius; } else { _modelConfig = null; _collideRadius = 0f; } }
/** 获取当前该显示的部件(包括默认值)(没有返回-1) */ public int getShowPart(int type) { int partID; if ((partID = getPartID(type)) != -1) { return(partID); } int modelID; if ((modelID = _data.modelID) == -1) { return(-1); } return(ModelConfig.get(modelID).showPartsT.getOrDefault(type, -1)); }
private GameObject createModel(int modelID, SceneElementEditorData eData) { ModelConfig config = ModelConfig.get(modelID); GameObject obj = new GameObject(getElementName(eData)); SceneElementComponent component = obj.AddComponent <SceneElementComponent>(); component.instanceID = eData.config.instanceID; if (config != null) { GameObject asset = AssetDatabase.LoadAssetAtPath <GameObject>(ShineToolGlobal.assetSourceStr + "/" + config.source); GameObject newOne = GameObject.Instantiate(asset); newOne.transform.SetParent(obj.transform); } //TODO:根据type设置layer obj.transform.SetParent(_unitLayer.transform); return(obj); }