private void OnVelocityChanged(double X, double Y, double Z) { velocityX = X; velocityY = Y; velocityZ = Z; VelocityChanged?.Invoke(velocityX, velocityY, velocityZ); }
private void OnControllerColliderHit(ControllerColliderHit hit) { if (hit.collider.CompareTag("Obstacle")) { velocity = velocity.Bounce(hit.normal); VelocityChanged?.Invoke(velocity); } }
public void SetVelocity(int n, float v) { n -= offset; if (n >= 0 && n < velocities.Length) { float value = Math.Min(Math.Max(v, 0), 1); if (value != velocities[n]) { velocities[n] = value; VelocityChanged?.Invoke(this, new KeyInputEvent { Note = n + offset, Velocity = velocities[n] }); Invalidate(); } } }
protected override void OnMouseUp(MouseEventArgs e) { if (selectedIndex >= 0) { velocities[selectedIndex] = 0; if (VelocityChanged != null) { VelocityChanged.Invoke(this, new KeyInputEvent { Note = selectedIndex + offset, Velocity = velocities[selectedIndex] }); } PianoKeyUp?.Invoke(this, new KeyInputEvent { Note = selectedIndex + offset }); Invalidate(); } base.OnMouseUp(e); }
protected override void OnMouseDown(MouseEventArgs e) { selectedIndex = KeyFromPoint(e.Location); if (selectedIndex >= 0) { velocities[selectedIndex] = 1; if (VelocityChanged != null) { VelocityChanged.Invoke(this, new KeyInputEvent { Note = selectedIndex + offset, Velocity = velocities[selectedIndex] }); } PianoKeyDown?.Invoke(this, new KeyInputEvent { Note = selectedIndex + offset }); Invalidate(); } base.OnMouseDown(e); }
protected virtual void OnVelocityChanged(VelocityChangedEventArguments e) { VelocityChanged?.Invoke(this, e); }