public void DockingGrantedEvent(DockingGrantedEvent e) { if (e.LandingPad > 0 && e.LandingPad <= 45 && (e.StationType.ToLower() == "coriolis" || e.StationType.ToLower() == "orbis" || e.StationType.ToLower() == "ocellus" || e.StationType.ToLower() == "asteroidbase")) { LandingPad.Build(e.LandingPad); } }
private void OnCollisionEnter(Collision collision) { if (isDead) { return; } LandingPad landingPad = collision.gameObject.GetComponent <LandingPad>(); if (landingPad) { switch (landingPad.GetPadType()) { case LandingPad.PadType.FRIENDLY: // Might Consider Refuel Functionality break; case LandingPad.PadType.LANDING: StartCoroutine(LoadNextScene()); break; default: break; } } else { StartCoroutine(HandleDeath()); } }
//Trigger entry detection public void OnTriggerEnter(Collider col) { //Landing pad contact if (col.gameObject.tag == "Pad" && IsLanded == false) { Debug.Log("landing pad enter: " + col.gameObject.name); LandingPad lp = col.gameObject.GetComponentInChildren <LandingPad>(); Debug.Log("ENTER: " + col.gameObject.name + "CURRENT: " + navigationComputer.CurrentLandingPad.name); if (lp != navigationComputer.CurrentLandingPad) { //Debug.Log("VELOCITY: "+ plane.gameObject.GetComponent<Rigidbody>().velocity.magnitude); //if (plane.gameObject.GetComponent<Rigidbody>().velocity.magnitude <= 1f) //{ Debug.Log("CONTACT"); StartCoroutine(LandingPadContactHandler(lp)); //} } } else if (col.gameObject.tag == "Waypoint") { col.GetComponent <Collider>().enabled = false; Debug.Log("waypoint enter: " + col.gameObject.name); IsLanded = false; pathNavigator.WaypointPassed(); } else if (col.gameObject.tag == "Tunnel") { Debug.Log("course tunnel hit"); soundController.OffCourseWarning(); } }
private void Start() { myPlayerShip = FindObjectOfType <RocketShip>(); myLandingPad = FindObjectOfType <LandingPad>(); maxRocketFuel = FindObjectOfType <RocketShip>().GetMaxFuelLevel(); fuelGaugeSlider = GetComponentInChildren <Slider>(); }
private IEnumerator LandingPadContactHandler(LandingPad landingPad) { yield return(new WaitForSeconds(10)); plane.gameObject.GetComponent <Rigidbody>().useGravity = true; engineController.StopEngines(); IsLanded = true; navigationComputer.LandingPadContact(landingPad); }
public void LandingPadContact(LandingPad landingPad) { CurrentLandingPad = landingPad; landingPad.DeactivatePad(); //End flight flightDataVisualizer.SetLandedInterface(); //Destroy flight path pathNavigator.UnsetPath(); }
public void OnTriggerExit(Collider col) { //Landing pad take off if (col.gameObject.tag == "Pad" && IsLanded == true) { Debug.Log("landing pad exit: " + col.gameObject.name); LandingPad lp = col.gameObject.GetComponent <LandingPad>(); if (lp == navigationComputer.CurrentLandingPad) { IsLanded = false; } } }
public void OnLegCollision(Collider other) { LandingPad pad = other.gameObject.GetComponent <LandingPad>(); if (prevVel >= crashSpeed || !pad) { GameOver("Crashed", 0, true); } else { safeLegs += 1; currentPad = pad; } }
public void SetCurrentLandingPadToClosest() { GameObject[] gos; gos = GameObject.FindGameObjectsWithTag("LandingPad"); GameObject closest = null; float distance = Mathf.Infinity; Vector3 position = transform.position; foreach (GameObject go in gos) { Vector3 diff = go.transform.position - position; float curDistance = diff.sqrMagnitude; if (curDistance < distance) { closest = go; distance = curDistance; } } CurrentLandingPad = closest.GetComponent <LandingPad>(); }
private void OnCollisionStay(Collision collision) { if (lHandler.Landed && collision.gameObject.tag == "LandingPad") { LandingPad lp = collision.gameObject.GetComponentInParent <LandingPad>(); if (!lp.IsStartingPad && !lp.IsCleared) { lp.SetAsCleared(); int fuelUsed = fuel.GetFuelUsedSinceLastCheckpoint(); float landingVelocity = lHandler.LandingVelocity; float landingAngle = lHandler.LandingAngle; int rank = CalculateRank(landingVelocity, landingAngle, fuelUsed, lp.FuelTarget); //rankingsData.rankings[lp.StageID] = rank; rankingsData.SetRanking(lp.StageID, rank); FindObjectOfType <UIController>().ShowStageClearedUI(rank); fuel.ResetFuelUsedSinceLastCheckPoint(); } } }
public void SetCameraConstraints(LandingPad leftPad, LandingPad rightPad) { constraintLeft = leftPad.transform.position.x + cameraConstraintOffset; constraintRight = rightPad.transform.position.x - cameraConstraintOffset; }
public void DockingCancelledEvent(DockingCancelledEvent e) { LandingPad.Destroy(); }
public void DockedEvent(DockedEvent e) { LandingPad.Destroy(); }
// Start is called before the first frame update void Start() { myRocketShip = GetComponentInParent <RocketShip>(); myLandingPad = FindObjectOfType <LandingPad>(); }