private void LoadFromExisting() { icon = GPS.gpsIconParent.transform.GetChild(0).GetComponent <UnityEngine.UI.Image>(); icon.transform.SetParent(Minimap.miniMap); icon.rectTransform.sizeDelta = Minimap.mInstance.mask.sizeDelta * 0.035f; icon.rectTransform.localPosition = Minimap.GetPositionInMap(boxCollider.transform.position); }
private void InstantiateNew() { icon = Object.Instantiate(GPS.gpsNavigationPrefab).GetComponent <UnityEngine.UI.Image>(); icon.transform.SetParent(Minimap.miniMap); icon.rectTransform.sizeDelta = Minimap.mInstance.mask.sizeDelta * 0.035f; icon.rectTransform.localPosition = Minimap.GetPositionInMap(boxCollider.transform.position); }
private void Update() { var dir = Minimap.GetPositionInMap(image.rectTransform.position + Vector3.forward) - Minimap.GetPositionInMap(image.rectTransform.position); var angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; var lookRotation = Quaternion.AngleAxis(angle - 90, Vector3.forward); image.rectTransform.rotation = lookRotation; image.rectTransform.localPosition = Minimap.GetPositionInMap(resurrectionTombstone.transform); }