public virtual void SetActiveObject(LeapGameObject obj) { if (activeObj != null) return; activeObj = obj; activeObj.owner = this; }
public override void OnTriggerEnter(Collider c) { LeapGameObject obj = c.GetComponent <LeapGameObject>(); if (!handController.activeObj && obj) //if we're not already holding an object, and a new object was collided with, select object { HighlightClosest(obj); } }
public virtual void SetActiveObject(LeapGameObject obj) { if (activeObj != null) { return; } activeObj = obj; activeObj.owner = this; }
public override void OnTriggerExit(Collider c) { LeapGameObject obj = c.GetComponent <LeapGameObject>(); if (obj) { if (obj == highlightObj) { highlightObj = null; } obj.DeSelect(); } }
private void HighlightClosest(LeapGameObject obj) { if (highlightObj) { highlightObj = Vector3.Distance(obj.transform.position, handController.transform.position) < Vector3.Distance(highlightObj.transform.position, handController.transform.position) ? obj : highlightObj; } else { highlightObj = obj; } highlightObj.Select(); }
public LeapNoHandState(LeapGameObject obj) { if (!obj) return; if (obj.isStatePersistent) { if (obj.dropOnLost) obj.Release(handController); else obj.gameObject.SetActive(false); } else { obj.Release(handController); } }
public override void OnTriggerStay(Collider c) { LeapGameObject obj = c.GetComponent <LeapGameObject>(); if (!handController.activeObj && obj) //if we're not already holding an object, continue checking closest object to select { HighlightClosest(obj); if (highlightObj != null && obj != highlightObj) { obj.DeSelect(); return; } // Deselect and exit function if this is not the highlighted object if (IsGrabbing() && (highlightObj.owner == null || highlightObj.canUseBothHands)) { highlightObj.DeSelect(); handController.ChangeState(highlightObj.Activate(handController)); } } }
public LeapNoHandState(LeapGameObject obj) { if (!obj) { return; } if (obj.isStatePersistent) { if (obj.dropOnLost) { obj.Release(handController); } else { obj.gameObject.SetActive(false); } } else { obj.Release(handController); } }
public LeapRodGrabbingState(LeapGameObject obj) { activeObj = obj; }
public LeapGodHandState(LeapGameObject obj) { activeObj = obj; }
public LeapSwingableState(LeapGameObject obj) { activeObj = obj; swingableObj = (LeapSwingableObject)obj; }
public LeapDrivingState(LeapGameObject obj) { activeObj = obj; handOnSteeringWheel = ((LeapSteeringWheel)activeObj).PlaceHandOnSteeringWheel(handOnSteeringWheel); }
public LeapRollingState(LeapGameObject obj) { activeObj = obj; }
public LeapShootableState(LeapGameObject obj) { activeObj = obj; shootableObj = (LeapShootableObject)obj; }
public LeapHandleState(LeapGameObject obj) { activeObj = obj; handleObj = (LeapHandleObject)obj; }
public LeapDrivingLeverState(LeapGameObject obj) { activeObj = obj; }
public override void OnTriggerExit(Collider c) { LeapGameObject obj = c.GetComponent<LeapGameObject>(); if (obj) { if (obj == highlightObj) highlightObj = null; obj.DeSelect(); } }
private void HighlightClosest(LeapGameObject obj) { if (highlightObj) highlightObj = Vector3.Distance(obj.transform.position, handController.transform.position) < Vector3.Distance(highlightObj.transform.position, handController.transform.position) ? obj : highlightObj; else highlightObj = obj; highlightObj.Select(); }