virtual public void Create(Leap.Unity.Interaction.InteractionManager interactionManager, PinchDetector leftPinchDetector, PinchDetector rightPinchDetector) { _velocityFrames = new Vector3[ObjectManager.Instance.CreationForceWindowSize]; _creating = true; LeapRTSComponent.AllowScale = !OverrideLeapRTSScaling; LeapRTSComponent.enabled = true; LeapRTSComponent.PinchDetectorA = leftPinchDetector; LeapRTSComponent.PinchDetectorB = rightPinchDetector; LeapInteractionBehaviour.enabled = false; LeapInteractionBehaviour.Manager = interactionManager; // Turn off Collider and Rigidbody components to disable physics EnableCollidersAndRigidbodies(false); // Turn off materialized meshes EnableMaterializedMeshes(false); // Turn on outline meshes EnableOutlineMeshes(true); IlluminateOutlineBloom(); // Enable looping and play the creation sound effect EffectAudioSource.loop = true; EffectAudioSource.clip = AudioManager.Instance.GetAudioClip(GameAudioClipType.INTERACTABLE_OBJECT_CREATING); EffectAudioSource.Play(); }
virtual protected void HandleCollisionActions(Collision collision) { var velocityMag = collision.relativeVelocity.magnitude; DimOutlineBloom(velocityMag); // Play sound if the collision was 'energetic' enough if (velocityMag > 2.0f) //TODO: nice magic number broonas { EffectAudioSource.PlayOneShot(AudioManager.Instance.GetAudioClip(GameAudioClipType.INTERACTABLE_OBJECT_COLLISION)); } }
public void Stick(Collider stickedObject) { if (!_isStuck) { _isStuck = true; Rigidbody.transform.rotation = Quaternion.identity; Rigidbody.isKinematic = true; Rigidbody.gameObject.tag = "WallCube"; EffectAudioSource.PlayOneShot(AudioManager.Instance.GetAudioClip(GameAudioClipType.INTERACTABLE_OBJECT_STICK)); Rigidbody.gameObject.layer = LayerMask.NameToLayer("Environment"); Observable.TimerFrame(0, FrameCountType.EndOfFrame).TakeUntilDestroy(this).Subscribe(_ => { LightWallController wallScript = Rigidbody.gameObject.AddComponent <LightWallController>(); wallScript.LightPrefab = LightControllerObject; }); SetupUnsticking(stickedObject); } }
virtual public void Materialize() { // Turn off the Leap RTS controller - there can be only one active at a time LeapRTSComponent.enabled = false; LeapInteractionBehaviour.enabled = true; AddCreationForce(); // Turn on Collider and Rigidbody components to enable physics EnableCollidersAndRigidbodies(true); // Turn on materialized meshes EnableMaterializedMeshes(true); // Disable looping and play the materialization sound effect EffectAudioSource.pitch = 1; EffectAudioSource.loop = false; EffectAudioSource.Stop(); EffectAudioSource.PlayOneShot(AudioManager.Instance.GetAudioClip(GameAudioClipType.INTERACTABLE_OBJECT_MATERIALIZATION)); }