// Update is called once per frame void Update() { if (reduce == PitchClass.Pitch.ReducePitch) { Camera.main.gameObject.GetComponent <AudioSource>().pitch = Mathf.Lerp(1, 0.75f, Time.time * 1.2f); } else if (reduce == PitchClass.Pitch.IncreasePitch) { Camera.main.gameObject.GetComponent <AudioSource>().pitch = Mathf.Lerp(.75f, 1, Time.time * 1.2f); } if (_level.currentLevel() == 1) { Camera.main.gameObject.GetComponent <AudioSource>().clip = clips[3]; if (!Camera.main.gameObject.GetComponent <AudioSource>().isPlaying) { Camera.main.gameObject.GetComponent <AudioSource>().Play(); } } if (_level.currentLevel() == 2) { Camera.main.gameObject.GetComponent <AudioSource>().clip = clips[4]; if (!Camera.main.gameObject.GetComponent <AudioSource>().isPlaying) { Camera.main.gameObject.GetComponent <AudioSource>().Play(); } } if (_level.currentLevel() == 3) { Camera.main.gameObject.GetComponent <AudioSource>().clip = clips[5]; if (!Camera.main.gameObject.GetComponent <AudioSource>().isPlaying) { Camera.main.gameObject.GetComponent <AudioSource>().Play(); } } }
// Update is called once per frame void FixedUpdate() { int vfx_count; vfx_count = vfx_list.Count; if (vfx_count > 0) { for (int i = 0; i < vfx_count; ++i) { GameObject explosion = vfx_list[i]; if (explosion.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).IsName("End")) { vfx_list.Remove(explosion); --vfx_count; Destroy(explosion); } } } if (flag_rot) { current_angular = Mathf.SmoothDamp(current_angular, target_angular, ref ref_angular, 0.8f); transform.Rotate(new Vector3(0, current_angular * Time.deltaTime, 0)); flow_light.color = level_color[level.currentLevel()] * Mathf.Abs(Mathf.Sin(Mathf.PI * Time.time * level.currentLevel())); } }
// Update is called once per frame void Update() { selfdir = transform.position.normalized; dir = Vector3.SmoothDamp(dir, head.transform.position.normalized, ref s_v, 0.3f); float factor = Vector3.Dot(dir, selfdir); float wiggle = level.currentLevel() > 2 ? level.currentLevel() * wiggle_mag * Mathf.Sin(Time.time * level.currentLevel() * Mathf.PI) : 0; factor = Mathf.Clamp01(factor); factor = Mathf.Clamp(Mathf.Pow(factor, 2), 0.3f, 1) * (1 + level.currentLevel()) / 2; for (int i = 0; i < units.Length; ++i) { Vector3 pos = units[i].transform.localPosition; pos.y = ys[i] * factor * (y_mag + wiggle); units[i].transform.localPosition = pos; pos = Vector3.zero; pos.y = ys[i] * factor * (rot_mag); units[i].transform.LookAt(pos); } }