IEnumerator CarRush(CarProperty car) { if(rush) yield break; skillUsing = true; rush = true; car.AddSkillTime(); foreach(GameObject effect in speedUpEffects) { effect.active = true; } car.SlowDown(false); car.RPMUp(skillSetting[skillLevel - 1].effectPercent); car.TorqueUp(skillSetting[skillLevel - 1].effectPercent, Color.white); car.CanBrake(false); RushHornAudio.Play(); /* show effect while(){} */ yield return new WaitForSeconds(skillSetting[skillLevel - 1].skillEffectTimes); car.SlowDown(true); car.RPMUp(0); car.TorqueUp(0, Color.white); car.CanBrake(true); foreach(GameObject effect in speedUpEffects) { effect.active = false; } rush = false; skillUsing = false; RushHornAudio.Stop(); }
IEnumerator BiggerRush(CarProperty car) { if(rush) yield break; rush = true; skillUsing = true; animation["skill"].time = 0.0f; animation["skill"].speed = 1.0f; animation.CrossFade("skill"); StartCoroutine(ShowEffect()); StartCoroutine(ChangeColor(false)); car.AddSkillTime(); car.SlowDown(false); car.RPMUp(skillSetting[skillLevel - 1].effectPercent); car.TorqueUp(skillSetting[skillLevel - 1].effectPercent, Color.white); car.UnCrash(true); boxCollider.isTrigger = false; // boxCollider.transform.localPosition = Vector3.zero; float size = 1.0f; while(size < changeSize) { size += 0.1f; car.ChangeSize(size); if(smoothFollow.target == transform.root) smoothFollow.SendMessage("SetTarget", transform, SendMessageOptions.DontRequireReceiver); //smoothFollow.height = smoothFollow.height + 0.3f; yield return new WaitForSeconds(0.1f); } BigRushGrowAudio.Stop(); yield return new WaitForSeconds(skillSetting[skillLevel - 1].skillEffectTimes); car.SlowDown(true); car.RPMUp(0); car.TorqueUp(0, Color.white); while(size > 1.0f) { size -= 0.1f; car.ChangeSize(size); yield return new WaitForSeconds(0.1f); } foreach(GameObject effect in speedUpEffects) { effect.active = false; } animation["skill"].time = animation["skill"].length; animation["skill"].speed = -1.0f; animation.CrossFade("skill"); StartCoroutine(ChangeColor(true)); car.UnCrash(false); boxCollider.isTrigger = true; // boxCollider.transform.localPosition = new Vector3(0, -0.5f, 0); BigRushTurboAudio.Stop(); rush = false; skillUsing = false; if(smoothFollow.target == transform.root) { smoothFollow.SendMessage("SetTarget", transform, SendMessageOptions.DontRequireReceiver); } }