void Update() { state = interactiveObject.State; if (state == BaseInteractiveObject.ObjectState.Selected) { isSelected = true; } else { rigidbodyCmp.position = initPosition; rigidbodyCmp.rotation = initRotation; isSelected = false; } if (isSelected && state != stateLastFrame) { if (selectSound != null) { selectSound.Play(); } } stateLastFrame = interactiveObject.State; }
void Update() { state = door.State; if (state == BaseInteractiveObject.ObjectState.Selected) { isSelected = true; } else { isSelected = false; } if (isSelected && state != stateLastFrame) { if (selectSound != null) { selectSound.Play(); } } stateLastFrame = door.State; }
void Update() { state = moveablePhysicsObject.State; if (state == BaseInteractiveObject.ObjectState.Selected) { isSelected = true; } else { isSelected = false; } if (isSelected && state != stateLastFrame) { if (selectSound != null) { selectSound.audioSource.Play(); } } stateLastFrame = moveablePhysicsObject.State; }
void LateUpdate() { if (target == null || rendererCmp == null) { return; } BaseInteractiveObject.ObjectState state = target.State; if (state != lastState) { lastState = state; if (state == BaseInteractiveObject.ObjectState.Selected) { block.SetColor(colorID, selectedColor); rendererCmp.SetPropertyBlock(block); } else { block.SetColor(colorID, defaultColor); rendererCmp.SetPropertyBlock(block); } } }