public void InitRenderProperty(ITU_TmxLayerMeta _layerMeta, ITU_TmxRootMeta _mapMeta, GameObject _mapRootGo, ITU_RenderSetting _renderSetting, float _offsetZ, List <ITU_ExtensionBase> _allExtensionList) { mLayerMeta = _layerMeta; mMapMeta = _mapMeta; mRenderSetting = _renderSetting; mAllExtensionList = _allExtensionList; mLayerRootGo = new GameObject(mLayerMeta.layerName); mLayerRootGo.transform.parent = _mapRootGo.transform; mLayerRootGo.transform.localPosition = new Vector3(mLayerMeta.offsetX / mRenderSetting.pixelsPreUnit, -mLayerMeta.offsetY / mRenderSetting.pixelsPreUnit, _offsetZ); DoInitRenderProperty(); }
public virtual void HandelTileWithProperty(Vector2Int _tileIndex, Vector2 _tileTopCenterScenePos, float _tileWidthInUnit, float _tileHeightInUnit, ITU_TmxLayerMeta _layerMeta, ITU_TsxEachTileMeta _tileMeta) { }
public virtual void HandleLayerProperty(ITU_TmxLayerMeta _layerMeta, ITU_PropertieRootMeta _layerProperty) { }
public override void HandelTileWithProperty(Vector2Int _tileIndex, Vector2 _tileTopCenterScenePos, float _tileWidthInUnit, float _tileHeightInUnit, ITU_TmxLayerMeta _layerMeta, ITU_TsxEachTileMeta _tileMeta) { if (_tileMeta.property.HasProperty("IsWalkable")) { var pos = new Vector3(_tileTopCenterScenePos.x, -0.2f, _tileTopCenterScenePos.y - _tileHeightInUnit / 2f); var navTile = ITU_MeshTileMaker.MakeTile(_tileWidthInUnit, _tileHeightInUnit, 0.2f, navTempBlockMat); navTile.name = "NavTempBlock"; navTile.isStatic = true; navTile.transform.parent = mNavTempRootGo.transform; navTile.transform.localPosition = pos; } }
public override void OnRenderTile(Vector2Int _tileIndex, Vector2 _tileTopCenterScenePos, float _tileWidthInUnit, float _tileHeightInUnit, ITU_TmxLayerMeta _layerMeta, ITU_TsxEachTileMeta _tileMeta) { var minX = _tileTopCenterScenePos.x - _tileWidthInUnit / 2f; var maxX = _tileTopCenterScenePos.x + _tileWidthInUnit / 2f; var maxY = _tileTopCenterScenePos.y; var minY = _tileTopCenterScenePos.y - _tileHeightInUnit; minPosX = Mathf.Min(minPosX, minX); minPosY = Mathf.Min(minPosY, minY); maxPosX = Mathf.Max(maxPosX, maxX); maxPosY = Mathf.Max(maxPosY, maxY); }
public override void HandelTileWithProperty(Vector2Int _tileIndex, Vector2 _tileTopCenterScenePos, float _tileWidthInUnit, float _tileHeightInUnit, ITU_TmxLayerMeta _layerMeta, ITU_TsxEachTileMeta _tileMeta) { //Only replace tile in deco layer with prefab //the support deco is also used in Ground layer,and it will not replace. if (_layerMeta.layerName != "Deco") { return; } if (_tileMeta.property.HasProperty("IsDeco")) { var ID = _tileMeta.property.GetProperty("ID").value; var PrefabDeco = ID == "Box" ? PrefabBoxDeco : PrefabSupportDeco; var go = PrefabUtility.InstantiatePrefab(PrefabDeco) as GameObject; go.transform.parent = prefabDecoRoot.transform; go.transform.localEulerAngles = new Vector3(90, 0, 0); go.transform.position = new Vector3(_tileTopCenterScenePos.x, 1f, _tileTopCenterScenePos.y - +_tileHeightInUnit / 2f); } }