added item score multiplier

This commit is contained in:
Glence 2023-03-23 18:20:42 +08:00
parent 64bbc4d67a
commit 01cbba1f1f
2 changed files with 5 additions and 2 deletions

View File

@ -88,6 +88,8 @@ public class GameManager : Script
Input.SetMouseCentering(true); Input.SetMouseCentering(true);
Application.IsCursorVisible = false; Application.IsCursorVisible = false;
Application.FixDeltaTime = Time.DefaultFixDeltaTime; Application.FixDeltaTime = Time.DefaultFixDeltaTime;
AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored");
} }
protected override void start() protected override void start()
@ -244,6 +246,9 @@ public class GameManager : Script
if (currMultiplierCombo < maxMultiplierCombo) if (currMultiplierCombo < maxMultiplierCombo)
currMultiplierCombo += 1; currMultiplierCombo += 1;
Audio.SetParameter("Multiplier", currMultiplierCombo);
AudioHandler.audioClipHandlers["SFXItemScore"].Play();
MultiplierTextFx fx = multiplierText.GetScript<MultiplierTextFx>(); MultiplierTextFx fx = multiplierText.GetScript<MultiplierTextFx>();
if (fx) if (fx)
{ {

View File

@ -6,14 +6,12 @@ public class ScoringZone : Script
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored");
} }
protected override void onTriggerEnter(CollisionInfo info) protected override void onTriggerEnter(CollisionInfo info)
{ {
if (GameManager.Instance && info.GameObject.GetScript<Item>() && info.GameObject.IsActiveSelf && !info.GameObject.GetComponent<Collider>().GetCollisionShape(0).IsTrigger ) if (GameManager.Instance && info.GameObject.GetScript<Item>() && info.GameObject.IsActiveSelf && !info.GameObject.GetComponent<Collider>().GetCollisionShape(0).IsTrigger )
{ {
AudioHandler.audioClipHandlers["SFXItemScore"].Play();
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo; GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
GameManager.Instance.ItemScored(); GameManager.Instance.ItemScored();
info.GameObject.SetActive(false); info.GameObject.SetActive(false);