public void Update() { if (!Application.isPlaying) { return; } if (showVolume) { monitorInput_volume.Sample(audioSource.volume); } if (showPitch) { pitchMin = monitor_pitch.Min; pitchMax = monitor_pitch.Max; monitorInput_pitch.Sample(audioSource.pitch); } if (showIsPlaying) { monitorInput_isPlaying.Sample(audioSource.isPlaying ? 1f : 0f); } }
private void Sample() { if (rigidbody == null) { if (!missingRigidbodyWarning) { Debug.LogWarning("MonitorRigidbody requires a Rigidbody component.", this); missingRigidbodyWarning = true; } return; } if (showPosition) { Vector3 position = rigidbody.position; positionMin = monitor_position.Min; positionMax = monitor_position.Max; if (showPosition_x) { monitorInput_position_x.Sample(position.x); } if (showPosition_y) { monitorInput_position_y.Sample(position.y); } if (showPosition_z) { monitorInput_position_z.Sample(position.z); } } if (showRotation) { Vector3 rotation = rigidbody.rotation.eulerAngles; rotationMin = monitor_rotation.Min; rotationMax = monitor_rotation.Max; if (showRotation_x) { monitorInput_rotation_x.Sample(rotation.x); } if (showRotation_y) { monitorInput_rotation_y.Sample(rotation.y); } if (showRotation_z) { monitorInput_rotation_z.Sample(rotation.z); } } if (showVelocity) { Vector3 velocity = rigidbody.velocity; velocityMin = monitor_velocity.Min; velocityMax = monitor_velocity.Max; if (showVelocity_x) { monitorInput_velocity_x.Sample(velocity.x); } if (showVelocity_y) { monitorInput_velocity_y.Sample(velocity.y); } if (showVelocity_z) { monitorInput_velocity_z.Sample(velocity.z); } } if (showAngularVelocity) { Vector3 angularVelocity = rigidbody.angularVelocity; angularVelocityMin = monitor_angularVelocity.Min; angularVelocityMax = monitor_angularVelocity.Max; if (showAngularVelocity_x) { monitorInput_angularVelocity_x.Sample(angularVelocity.x); } if (showAngularVelocity_y) { monitorInput_angularVelocity_y.Sample(angularVelocity.y); } if (showAngularVelocity_z) { monitorInput_angularVelocity_z.Sample(angularVelocity.z); } } }
public void Update() { if (!Application.isPlaying) { return; } if (showPosition) { Vector3 position = positionSpace == Space.Local ? transform.localPosition : transform.position; positionMin = monitor_position.Min; positionMax = monitor_position.Max; if (showPosition_x) { monitorInput_position_x.Sample(position.x); } if (showPosition_y) { monitorInput_position_y.Sample(position.y); } if (showPosition_z) { monitorInput_position_z.Sample(position.z); } } if (showRotation) { Vector3 rotation = (rotationSpace == Space.Local ? transform.localRotation : transform.rotation).eulerAngles; rotationMin = monitor_rotation.Min; rotationMax = monitor_rotation.Max; if (showRotation_x) { monitorInput_rotation_x.Sample(rotation.x); } if (showRotation_y) { monitorInput_rotation_y.Sample(rotation.y); } if (showRotation_z) { monitorInput_rotation_z.Sample(rotation.z); } } if (showScale) { Vector3 scale = scaleSpace == ScaleSpace.Local ? transform.localScale : transform.lossyScale; scaleMin = monitor_scale.Min; scaleMax = monitor_scale.Max; if (showScale_x) { monitorInput_scale_x.Sample(scale.x); } if (showScale_y) { monitorInput_scale_y.Sample(scale.y); } if (showScale_z) { monitorInput_scale_z.Sample(scale.z); } } }
private void Sample() { if (rigidbody2D == null) { if (!missingRigidbodyWarning) { Debug.LogWarning("MonitorRigidbody requires a Rigidbody2D component.", this); missingRigidbodyWarning = true; } return; } if (showPosition) { Vector3 position = rigidbody2D.position; positionMin = monitor_position.Min; positionMax = monitor_position.Max; if (showPosition_x) { monitorInput_position_x.Sample(position.x); } if (showPosition_y) { monitorInput_position_y.Sample(position.y); } } if (showRotation) { rotationMin = monitor_rotation.Min; rotationMax = monitor_rotation.Max; if (showRotation) { float rotation = rigidbody2D.rotation; if (rotationClamp) { if (rotation > 0) { rotation = rotation % 360f; } else { rotation = rotation - 360f * Mathf.FloorToInt(rotation / 360f); } } monitorInput_rotation.Sample(rotation); } } if (showVelocity) { Vector3 velocity = rigidbody2D.velocity; velocityMin = monitor_velocity.Min; velocityMax = monitor_velocity.Max; if (showVelocity_x) { monitorInput_velocity_x.Sample(velocity.x); } if (showVelocity_y) { monitorInput_velocity_y.Sample(velocity.y); } } if (showAngularVelocity) { angularVelocityMin = monitor_angularVelocity.Min; angularVelocityMax = monitor_angularVelocity.Max; if (showAngularVelocity) { monitorInput_angularVelocity.Sample(rigidbody2D.angularVelocity); } } }