internal void UpdateValue(int actual, int max) { if (CutMask != null) { float percent = actual / (float)max; float CutMaskActualY = CutMaskStartingY - CutMaskHeight * (1 - percent); Vector3 pos = CutMask.GetComponent <RectTransform>().position; pos.y = CutMaskActualY; CutMask.GetComponent <RectTransform>().position = pos; } }
void OnEnable() { if (Image1 != null) { Vector3 lifeImage2Pos = Image1.GetComponent <RectTransform>().position; lifeImage2Pos.y -= Image1.GetComponent <RectTransform>().GetHeight(); Image2.GetComponent <RectTransform>().position = lifeImage2Pos; StartingPos = Image1.GetComponent <RectTransform>().position; CutMaskStartingY = CutMask.transform.position.y; CutMaskHeight = CutMask.GetComponent <RectTransform>().GetHeight(); } }