public void SpeedChange(Flamemove target) { //If the target is still changing, instantly change the speed to prevent getting stuck in the previous change enumerator if (target.isChanging) { WayPoints.HaltAllSpeedChanges(); } StartCoroutine(Change(target)); }
private IEnumerator Change(Flamemove target) { target.isChanging = true; while (!Mathf.Approximately(target.speed, speed)) { target.speed = Mathf.MoveTowards(target.speed, speed, Time.deltaTime * 0.5f); yield return(null); } target.isChanging = false; }
private void Start() { player = FindObjectOfType <PlayerController>(); particles = GetComponent <ParticleSystem>(); flameLight = GetComponentInChildren <Light>(false); originalROT = particles.emission.rateOverTime.constant; originalLightIntensity = flameLight.intensity; source = GetComponent <AudioSource>(); flame = GetComponentInParent <Flamemove>(); }