public void AddRoom(IntVector3 roomPos) { MinimapImage img = null; switch (roomPos.y) { case -1: img = minimapImgBasement; break; case 0: img = minimapImgGround; break; case 1: img = minimapImgUpstairs; break; } if (img == null) { return; } //minimap.ClearQuad(); Rect r = img.GetPixelAdjustedRect(); Vector2 center = r.center; center.x += roomPos.x * 20; center.y += roomPos.z * 20; center -= new Vector2(10, 10); Rect pos = new Rect(center, new Vector2(19, 19)); img.AddQuad(pos, new Rect(0, 0, 1, 1)); img.SetMeshDirty(); }
void Init() { uiPanel = transform.GetChild(0); useHint = uiPanel.GetChild(0).GetComponent <Text>(); useHint.enabled = false; Transform attrib = uiPanel.GetChild(1); txtStrengthArr = attrib.GetChild(0).GetComponent <Text>(); txtIntelArr = attrib.GetChild(1).GetComponent <Text>(); txtSpiritArr = attrib.GetChild(2).GetComponent <Text>(); txtMovePointArr = attrib.GetChild(3).GetComponent <Text>(); movePoint = uiPanel.GetChild(2).GetComponent <Text>(); messageBox = uiPanel.GetChild(3).GetComponent <Text> (); roomName = uiPanel.GetChild(4).GetComponent <Text>(); sliderObj = uiPanel.GetChild(6).gameObject; slider = sliderObj.GetComponent <Slider>(); sliderObj.SetActive(false); minimapMgr = new UI.Minimap(); UI.MinimapImage basement = uiPanel.GetChild(7).GetChild(0).GetComponent <UI.MinimapImage>(); UI.MinimapImage ground = uiPanel.GetChild(7).GetChild(1).GetComponent <UI.MinimapImage>(); UI.MinimapImage upstairs = uiPanel.GetChild(7).GetChild(2).GetComponent <UI.MinimapImage>(); RawImage charImg = uiPanel.GetChild(7).GetChild(3).GetComponent <RawImage>(); minimapMgr.Init(basement, ground, upstairs, charImg); }
public void Dispose() { minimapImgBasement = null; minimapImgGround = null; minimapImgUpstairs = null; mainCharImg = null; mainPawn = null; }
public void Init(MinimapImage basement, MinimapImage ground, MinimapImage upstairs, RawImage charImg) { minimapImgBasement = basement; minimapImgGround = ground; minimapImgUpstairs = upstairs; mainCharImg = charImg; bkgCenter = basement.rectTransform.offsetMin + basement.rectTransform.offsetMax; bkgCenter /= 2; SetLayer(LAYER.GROUND); }