//GameObject HitGameObject; // Update is called once per frame public void GetLookAtObject() { LookAtIntersectedObject = null; LookAtStandObject = null; LookAtIntersectedObjectID = ""; //FsmVariables.GlobalVariables.GetFsmGameObject("IntersectedObject").Value = null; RaycastHit[] hits; hits = Physics.RaycastAll(transform.position, transform.forward, 4.0F); for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; //Find ObjectClass script inside intersected object StandObject iObject = hit.transform.GetComponentInChildren<StandObject>(); if (iObject != null) { LookAtIntersectedObject = hit.transform.gameObject; LookAtStandObject = LookAtIntersectedObject.GetComponentInChildren<StandObject>(); //FsmVariables.GlobalVariables.GetFsmGameObject("IntersectedObject").Value = IntersectedObject; } } }
public void GetMouseObject() { MouseIntersectedObject = null; MouseStandObject = null; MouseIntersectedObjectID = ""; //FsmVariables.GlobalVariables.GetFsmGameObject("IntersectedObject").Value = null; RaycastHit[] hits; Ray MouseRay = this.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition); hits = Physics.RaycastAll(MouseRay, 10.0F); for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; //Find ObjectClass script inside intersected object StandObject iObject = hit.transform.GetComponentInChildren<StandObject>(); if (iObject != null) { MouseIntersectedObject = hit.transform.gameObject; MouseStandObject = MouseIntersectedObject.GetComponentInChildren<StandObject>(); //FsmVariables.GlobalVariables.GetFsmGameObject("IntersectedObject").Value = IntersectedObject; } } }
public void Clean() { if (StandObject != null) { StandObject.Remove(); } if (Deck != null) { Deck.Remove(); } if (StandAirPipe != null) { StandAirPipe.Remove(); } if (StandCable != null) { StandCable.Remove(); } }