// public LightScript lightScript; //Start private void Start() { //zone1.SetActive(true); //zone2.SetActive(false); inUpDraft = false; audio = FindObjectOfType <AudioManager>(); creditsMenu = GameObject.Find("Credits Menu"); creditsMenu.SetActive(false); //Calling Scripts debugLines = GetComponent <DebugLines>(); flyingStates = GetComponent <FlyingStates>(); playerCollider = GetComponent <BoxCollider>(); camFollow = GetComponent <CamFollow>(); input = GetComponent <InputManager>(); rotationController = GetComponent <RotationController>(); animationScript = GetComponent <AnimationScript>(); loadLevel = GetComponent <LoadLevel>(); // lightScript.light.color = lightScript.Cavecolor; //boostLight.SetActive(false); //windStream.SetActive(false); flyingStates.WingStreamsOff(); FindObjectOfType <AudioManager>().StopPlayingAudio("Boost"); EndGameUI.SetActive(false); }
private void FixedUpdate() { flyingStates.CheckFlyingStates(); ReduceAddVelocity(); if (flyingStates.isBoosting == false) { flyingStates.rb.velocity = flyingStates.baseVelocity + flyingStates.addedVelocity; } else if (flyingStates.isBoosting == true) { flyingStates.boostSpeed = Mathf.Lerp(0, flyingStates.boostSpeed, 1); flyingStates.baseVelocity += transform.forward * flyingStates.boostSpeed; } flyingStates.Speed = flyingStates.baseVelocity.magnitude; flyingStates.Speed = Mathf.Lerp(flyingStates.Speed, flyingStates.currentTargetSpeed, flyingStates.currentTargetForce * Time.deltaTime); flyingStates.baseVelocity = (flyingStates.rb.transform.forward * flyingStates.Speed); flyingStates.rb.velocity = flyingStates.baseVelocity + flyingStates.addedVelocity; if (flyingStates.rb.velocity.magnitude >= 100f) { if (!isPlayingAudio) { audio.PlayAudio("FlyingFast"); isPlayingAudio = true; } if (flyingStates.wingsOut == false) { } else if (flyingStates.wingsOut == true) { flyingStates.WingStreamsOn(); } } else { audio.StopPlayingAudio("FlyingFast"); isPlayingAudio = false; if (flyingStates.wingsOut == false) { } else if (flyingStates.wingsOut == true) { flyingStates.WingStreamsOff(); } } flyingStates.TerminalBoost(); flyingStates.UseBoosFuel(); if (inUpDraft == true) { currentSpeed = flyingStates.rb.velocity; var upDraftBoost = 3; for (int i = 0; i < upDraftBoost; i++) { flyingStates.addedVelocity += (updraftDirection); } } flyingStates.rot.x += flyingStates.drop; flyingStates.rb.velocity += -Vector3.up * slowFallMultiplier; }