/// <summary> /// /// </summary> /// <param name="collision"></param> void OnCollisionStay(Collision collision) { foreach (ContactPoint contactPoint in collision.contacts) { Debug.DrawRay(contactPoint.point, contactPoint.normal * 10, Color.white); //if the car body is being hit, then we need to inflict damage if (contactPoint.thisCollider.tag == clsGameConstants.strPlayerTag) { //the car body is hitting something //inflictDamage(Time.deltaTime); } if (contactPoint.thisCollider.tag == clsGameConstants.strLandingGearTag) { //we may have landed. //are we moving? if (rigidbody.angularVelocity.magnitude < clsGameConstants.fltLandingVelocity && rigidbody.velocity.magnitude < clsGameConstants.fltLandingVelocity ) { //the landing gear is touching something and we are not moving. we have landed state = enStates.landed; //now we need to know where we landed string strLandingSite = contactPoint.otherCollider.tag; //Debug.Log("strlanding site tag = " + strLandingSite); ResolveLocation(strLandingSite); //Debug.Log("resolved taxi location = " + this.location); if (psngrScript.location == clsGameConstants.enLocations.InTheTaxi) { //We're here. Tell the passenger to get out!!! psngrScript.TellPassengerToGetOut(); } else { //invite the passenger to come aboard psngrScript.InviteToBoard(); } } } } }
/// <summary> /// Awake this instance. /// </summary> void Awake() { objTaxiTop = GameObject.Find("taxiTop"); state = enStates.landed; scrTaxiDriver.Instance = this; smoke = gameObject.GetComponentInChildren<ParticleEmitter>(); //load the score from the previous level fltEarnings = PlayerPrefs.GetFloat(clsGameConstants.strEarningsKey); intLives = PlayerPrefs.GetInt(clsGameConstants.strLivesKey); reSpawnPlayer(); //turn the taxi light on SetTaxiSign(true); }