public void GrabEvent() { if (ActivePrograms.Count > 0) { ActivePrograms[_lastActiveProgram].transform.gameObject.GetComponent <ProgramLogic>().Invoke("OnGrab", 0); if (GazeCursorEnabled) { GazeCursor.GetComponent <GazeCursor>().Invoke("OnGrab", 0); } #region Lerp Grab Mechanic if (_lerpGrabEnabled == true) { if (LerpState == false) { if (SelectedObject.GetComponent <ObjectMass>() != null) { ObjectMassScript = ActivePrograms[_lastActiveProgram].transform.gameObject.GetComponent <ObjectMass>(); LerpTime = ObjectMassScript.DigitalObjectMass; } if (SelectedObject.GetComponent <ObjectMass>() == null) { LerpTime = DefaultObjectMass; } TargetLocation.transform.position = SelectedObject.transform.position; LerpState = true; RaycastLineRender.enabled = _lineRenderFalse; } } } #endregion }
public override void OnInspectorGUI() { ObjectMass TargetScript = (ObjectMass)target; EditorGUILayout.Space(); EditorGUILayout.HelpBox("Define the mass of this object, the higher the value, the more sluggish it will be when you grab it.", MessageType.None, true); TargetScript.DigitalObjectMass = EditorGUILayout.Slider("Object Mass:", TargetScript.DigitalObjectMass, 0, 100); if (TargetScript.DigitalObjectMass < 3) { EditorGUILayout.HelpBox("If you make the mass " + TargetScript.DigitalObjectMass + ", it will be very jittery, consider making this higher.", MessageType.Warning, true); } if (TargetScript.DigitalObjectMass > 20) { EditorGUILayout.HelpBox("If you make the mass " + TargetScript.DigitalObjectMass + ", it will be very sluggish, consider making this lower.", MessageType.Warning, true); } }
// Start is called before the first frame update void Start() { _power = GetComponent <Power>(); _objectMass = GetComponent <ObjectMass>(); }