public void UpdateLightGizmoHint() { if (m_LightGizmoHoverTimer >= 0) { if (!m_LightGizmoHint) { var hint = Instantiate(m_LightGizmoHintPrefab); m_LightGizmoHint = hint.GetComponent<HintObjectScript>(); } // TODO: Fix this. // This assumes there is only one panel of type Lights created. BasePanel basePanel = PanelManager.m_Instance.GetPanelByType(BasePanel.PanelType.Lights); LightsPanel lightsPanel = basePanel as LightsPanel; if (lightsPanel != null) { if (lightsPanel.IsLightGizmoBeingDragged) { m_LightGizmoHoverTimer = -1; if (m_LightGizmoHint.IsActive()) { m_LightGizmoHint.Activate(false); } } else if (lightsPanel.IsLightGizmoBeingHovered) { m_LightGizmoHoverTimer += Time.deltaTime; if (m_LightGizmoHoverTimer > m_LightGizmoHoverTimeBeforeHint) { if (!m_LightGizmoHint.IsActive()) { m_LightGizmoHint.Activate(true); } m_LightGizmoHint.transform.position = lightsPanel.ActiveLightGizmoPosition; m_LightGizmoHint.transform.rotation = lightsPanel.transform.rotation; } } else { m_LightGizmoHint.Activate(false); m_LightGizmoHoverTimer = m_LightGizmoHoverTimeBeforeHint / 2; } } } }
void Update() { switch (m_MoveMode) { case Movement.Still: break; case Movement.Drift: m_JumpTimer -= Time.deltaTime; // Move forward. float speed = m_Jumping ? m_JumpSpeed : m_DriftSpeed; m_MoveTimer += Time.deltaTime * speed; if (m_MoveTimer >= 1.0f) { // If we're passed our threshold, udpate our curves. AdvanceCurves(); m_MoveTimer -= 1.0f; m_Jumping = false; } // TODO: Fix this. // This assumes there is only one panel of type Lights created. BasePanel basePanel = PanelManager.m_Instance.GetPanelByType(BasePanel.PanelType.Lights); LightsPanel lightsPanel = basePanel as LightsPanel; if (lightsPanel) { for (int i = 0; i < m_DiscoCurves.Length; ++i) { m_DiscoCurves[i].lerpColor = Color.Lerp(m_DiscoCurves[i].startColor, m_DiscoCurves[i].targetColor, m_MoveTimer); var lightGizmo = lightsPanel.GetLight((LightMode)i); if (lightGizmo != null) { lightGizmo.SetRotation( Quaternion.Slerp(m_DiscoCurves[i].start, m_DiscoCurves[i].target, m_MoveTimer)); } } lightsPanel.SetDiscoLights(m_DiscoCurves[0].lerpColor, m_DiscoCurves[1].lerpColor, m_DiscoCurves[2].lerpColor, noRecord: true); } // Speed to the next checkpoint if we're listening to music and we hit a threshold. if (m_JumpTimer < 0.0f && App.Instance.RequestingAudioReactiveMode) { if (VisualizerManager.m_Instance.BeatOutput.z > m_BeatThreshold) { m_Jumping = true; // Prevent jumping from happening too quickly, back to back. m_JumpTimer = m_JumpInterval; } } break; } }
public void SetParentPanel(LightsPanel panel) { Debug.AssertFormat(m_ParentPanel == null, "Light Gizmo parent already set!"); m_ParentPanel = panel; App.Scene.PoseChanged += (TrTransform prev, TrTransform current) => { transform.rotation = current.rotation * m_Rotation_SS; transform.position = m_ParentPanel.LightWidgetPosition(transform.rotation); }; }
override protected void OnButtonPressed() { LightsPanel lightsParent = m_Manager.GetComponent <LightsPanel>(); if (lightsParent) { lightsParent.ButtonPressed(m_ButtonType); } }