private void Update_TriggerStatus() { slidePart[] a = new slidePart[] { Bad1, Good, Perfect, Bad2 }; float r = moveRange / 360f; float total = a.Select(x => x.triggerPoint).Sum(); if (total == 0) return; float rot = 0; for (int i = 0; i < a.Length; i++) { a[i].t.localRotation = Quaternion.Euler(0, 0, rot); a[i].Image.fillAmount = r * (a[i].triggerPoint / total); rot -= moveRange * (a[i].triggerPoint / total); } }
state statusCheck() { slidePart[] a = new slidePart[] { Bad1, Good, Perfect, Bad2 }; float total = a.Select(x => x.triggerPoint).Sum(); if (total == 0) return state.bad; float called = -(curve - (moveRange / 2f)) / moveRange; float counter = 0; int heighest = 0; for (int i = 0; i < a.Length; i++) { if (called > counter) heighest = i; counter += a[i].triggerPoint / total; } return a[heighest].State; }