public virtual void AddClimber(Climbable climbable, Grabber grab) { if (climbers == null) { climbers = new List <Grabber>(); } if (!climbers.Contains(grab)) { if (grab.DummyTransform == null) { GameObject go = new GameObject(); go.transform.name = "DummyTransform"; go.transform.parent = grab.transform; go.transform.position = grab.transform.position; go.transform.localEulerAngles = Vector3.zero; grab.DummyTransform = go.transform; } // Set parent to whatever we grabbed. This way we can follow the object around if it moves grab.DummyTransform.parent = climbable.transform; grab.PreviousPosition = grab.DummyTransform.position; // Play haptics if (ApplyHapticsOnGrab) { InputBridge.Instance.VibrateController(VibrateFrequency, VibrateAmplitude, VibrateDuration, grab.HandSide); } climbers.Add(grab); } }
public override void OnInspectorGUI() { climbable = (Climbable)target; // Don't use Custom Editor if (UseCustomEditor == false || climbable.UseCustomInspector == false) { base.OnInspectorGUI(); return; } EditorGUILayout.PropertyField(grabButton); EditorGUILayout.PropertyField(grabType, new GUIContent("Grab Type")); EditorGUILayout.PropertyField(grabMechanic); EditorGUILayout.PropertyField(hideHandGraphics); EditorGUILayout.PropertyField(parentHandModel); EditorGUILayout.PropertyField(snapHandModel); EditorGUILayout.PropertyField(canBeDropped); EditorGUILayout.PropertyField(CanBeSnappedToSnapZone); EditorGUILayout.PropertyField(CustomHandPose); EditorGUILayout.PropertyField(GrabPoints); // Only show Debug Fields when playing in editor if (Application.isPlaying) { EditorGUILayout.PropertyField(collisions); } serializedObject.ApplyModifiedProperties(); }
public void AddClimber(Climbable climbable, Grabber grab) { if (!climbers.Contains(grab)) { if (grab.DummyTransform == null) { GameObject go = new GameObject(); go.transform.name = "DummyTransform"; go.transform.parent = grab.transform; go.transform.position = grab.transform.position; go.transform.localEulerAngles = Vector3.zero; grab.DummyTransform = go.transform; } // Set parent to whatever we grabbed. This way we can follow the object around if it moves grab.DummyTransform.parent = climbable.transform; grab.PreviousPosition = grab.DummyTransform.position; climbers.Add(grab); } }