public void AddInputMarker(LevelManager.ActionResult markerType, float time) { float metronomeValue = Mathf.PingPong((float)BeatManager.GetBeatTime(time), 1f); RectTransform marker = Instantiate(InputMarkerPrefabs[(int)markerType], InputsDisplay).GetComponent <RectTransform>(); Vector2 anchoredPos = marker.anchoredPosition; Vector2 anchorMin = marker.anchorMin; Vector2 anchorMax = marker.anchorMax; anchoredPos.x = 0f; anchorMin.x = anchorMax.x = metronomeValue; marker.anchorMin = anchorMin; marker.anchorMax = anchorMax; marker.anchoredPosition = anchoredPos; marker.gameObject.AddComponent <Autodestroy>().destroyTimer = 1 / (BeatManager.bpm / 60f); marker.GetComponent <EffectGUIColourOverLifetime>().Initiate(); }
void Update() { float beat = (float)BeatManager.GetBeatTime(); BeatSlider.value = Mathf.PingPong(beat, 1f); }