public void SetCanvasLayer(eTileLayer layer) { GameObject canvasObject = transform.Find("Canvas").gameObject; int sortingID = SortingLayer.NameToID(layer.ToString()); canvasObject.GetComponent <Canvas>().sortingLayerID = sortingID; }
override public void SetSortingOrder(eTileLayer layer, int sortingOrder) { _tileLayer = layer; int sortingID = SortingLayer.NameToID(layer.ToString()); _characterView.GetComponent <SpriteRenderer>().sortingLayerID = sortingID; _characterView.GetComponent <SpriteRenderer>().sortingOrder = sortingOrder; }
//Sort virtual public void SetSortingOrder(eTileLayer layer, int sortingOrder) { _tileLayer = layer; int sortingID = SortingLayer.NameToID(layer.ToString()); gameObject.GetComponent <SpriteRenderer>().sortingLayerID = sortingID; gameObject.GetComponent <SpriteRenderer>().sortingOrder = sortingOrder; }
public void AddObject(eTileLayer layer, MapObject mapObject) { List <MapObject> mapObjectList = _mapObjectMap[(int)layer]; int sortingID = SortingLayer.NameToID(layer.ToString()); int sortingOrder = mapObjectList.Count; mapObject.SetSortingOrder(sortingID, sortingOrder); mapObject.SetPosition(_position); mapObjectList.Add(mapObject); }
//타일셀 정보에 추가 public void AddObject(MapObject mapObject, eTileLayer layer, bool setTilePos = true) { List <MapObject> mapObjectList = _mapObjectListByLayer[(int)layer]; if (!mapObjectList.Contains(mapObject)) //중복삽입 방지 { mapObjectList.Add(mapObject); } if (eTileLayer.RANGE == layer) { return; } if (eTileLayer.ITEM == layer) { //아이템: 최신이 제일 앞에 오게 mapObject.GetComponent <SpriteRenderer>().sortingOrder = _itemLayerOrder; _itemLayerOrder++; } else { if (eMapObjectType.CHARACTER != mapObject.GetMapObjectType() && eMapObjectType.PLAYER != mapObject.GetMapObjectType() && eMapObjectType.ENEMY != mapObject.GetMapObjectType()) { mapObject.GetComponent <SpriteRenderer>().sortingOrder = _groundLayerOrder; } } mapObject.SetCurrentLayer(layer); int sortingLayerID = SortingLayer.NameToID(layer.ToString()); mapObject.GetComponentInChildren <SpriteRenderer>().sortingLayerID = sortingLayerID; if (setTilePos) { mapObject.SetTilePosition(_tileX, _tileY); } }