void OnTriggerExit(Collider other) { HoverScript hs = other.gameObject.GetComponent <HoverScript>(); if (hs != null) { shipsLap += 1; if (hs.numberLaps == maxNumberLaps && other.tag == "Player") { endMenu.enabled = true; pos.text = "Position: " + shipsLap; other.attachedRigidbody.velocity = Vector3.zero; } else { hs.numberLaps += 1; } if (shipsLap == shipNumber) { shipsLap = 0; } } }
void OnTriggerEnter(Collider other) { HoverScript hs = other.gameObject.GetComponent <HoverScript>(); if (hs != null) { hs.m_forwardAcc = 0; other.attachedRigidbody.velocity = Vector3.zero; } Destroy(gameObject); }
// Update is called once per frame void Update() { if (transform.localScale.x < 0.8) { transform.localScale = Vector3.MoveTowards(transform.localScale, new Vector3(0.08f * direction, 0.08f, 1), 0.0005f); } if (timeToLive <= 0) { DoEndOfLife(); return; } CheckTouch(); UpdateHalo(); HoverScript.doHover(gameObject); }
// Used for initialization void Start() { gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>(); playerInputs = gameController.gameObject.GetComponent <PlayerInputsScript>(); hoverScript = GetComponent <HoverScript>(); audioController = GetComponent <AudioController>(); rigBody = GetComponent <Rigidbody>(); rigBody.maxAngularVelocity = 5; com = rigBody.centerOfMass - new Vector3(0, 0, rigBody.centerOfMass.z); rigBody.centerOfMass = com; turnForce *= rigBody.mass; yawForce *= rigBody.mass; pitchForce *= rigBody.mass; rollForce *= rigBody.mass; fakeRoll *= rigBody.mass; }
public void OnInputClicked(InputClickedEventData eventData) { GameObject focusedObject = FocusManager.Instance.GetFocusedObject(GazeManager.Instance); if (focusedObject == null) { // Debug.Log("Focused Object null"); if (HoverScript.activeObj != null) { //Debug.Log("Active Object not null"); HoverScript.informationPanel.SetActive(false); HoverScript.buttonSettings.SetActive(true); HoverScript.buttonExtended.SetActive(false); HoverScript.buttonDeveloper.SetActive(false); HoverScript.boundingBox.SetActive(false); GameObject.Find("Holograms").GetComponent <PanelScript>().keyboard.Close(); HoverScript activeHover = HoverScript.activeObj.GetComponent <HoverScript>(); } } }
void Awake() { thruster = GetComponent<EngineThruster>(); health = GetComponent<EngineHealth>(); info = GetComponent<RigidbodyInfo>(); hoverScript = GetComponent<HoverScript>(); wobbleGenerator = GetComponent<WobbleGenerator>(); trans = transform; rgb = GetComponent<Rigidbody>(); }
void OnTriggerStay(Collider other) { HoverScript hs = other.gameObject.GetComponent <HoverScript> (); hs.m_forwardAcc = accel; }