diff --git a/RhythmKata/Assets/Resources/SFX/SFX Project/sfx Project/Samples/Recorded.meta b/RhythmKata/Assets/Resources/SFX/SFX Project/sfx Project/Samples/Recorded.meta deleted file mode 100644 index dd079caf60b39b32ef37288a778b123d61ada7e4..0000000000000000000000000000000000000000 --- a/RhythmKata/Assets/Resources/SFX/SFX Project/sfx Project/Samples/Recorded.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d9a533cec04e2124e9c31541b4f63e72 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/RhythmKata/Assets/Scripts/CameraController.cs b/RhythmKata/Assets/Scripts/CameraController.cs index e181a44004355af487f57626def643fe6e67fee4..d9089954ac19b98f9f65a986f9c07dee94ec29aa 100644 --- a/RhythmKata/Assets/Scripts/CameraController.cs +++ b/RhythmKata/Assets/Scripts/CameraController.cs @@ -13,10 +13,7 @@ public class CameraController : MonoBehaviour // Update is called once per frame void Update() { - if (Input.GetMouseButtonDown(0)) - { - CameraShake(0.2f, 0.1f); - } + } private void OnDrawGizmos() diff --git a/RhythmKata/Assets/Scripts/EdgeNoteObject.cs b/RhythmKata/Assets/Scripts/EdgeNoteObject.cs index aa5d0f96a7b552a2484c94d46a67abda46504bfb..b38ca19c1a3cf4b0d6a8d43e4d37225c0278d60f 100644 --- a/RhythmKata/Assets/Scripts/EdgeNoteObject.cs +++ b/RhythmKata/Assets/Scripts/EdgeNoteObject.cs @@ -28,7 +28,7 @@ public class EdgeNoteObject : NoteObject { PlayJudgeSfx(type); - PlayEngine.inst.HandleNoteJudge(type.type); + PlayEngine.inst.HandleNoteJudge(type); BlinkLight light = Instantiate(PlayEngine.inst.edgeHitEffectPrefab, -5 * direction, Quaternion.identity); light.transform.LookAt(Vector3.zero); light.Init(type.type); diff --git a/RhythmKata/Assets/Scripts/NoteObject.cs b/RhythmKata/Assets/Scripts/NoteObject.cs index 4c67a08233b93a7b67e5a702a908320a1594b93d..115a52e724268d9524c4fcf0369b03b435605f90 100644 --- a/RhythmKata/Assets/Scripts/NoteObject.cs +++ b/RhythmKata/Assets/Scripts/NoteObject.cs @@ -77,7 +77,7 @@ public abstract class NoteObject : MonoBehaviour if (trailRenderer) trailRenderer.enabled = false; - PlayEngine.inst.HandleNoteJudge(judge.type); + PlayEngine.inst.HandleNoteJudge(judge); } } diff --git a/RhythmKata/Assets/Scripts/PlayEngine.cs b/RhythmKata/Assets/Scripts/PlayEngine.cs index 147766c2be7af29eab47d8168429c1a1a45c4013..e4a73b7fb4adcb228fde12ad6ebac9e085042040 100644 --- a/RhythmKata/Assets/Scripts/PlayEngine.cs +++ b/RhythmKata/Assets/Scripts/PlayEngine.cs @@ -41,8 +41,10 @@ public class PlayEngine : SingletonBehaviour<PlayEngine> private MotionTracker leftHandTracker = new MotionTracker(); private MotionTracker rightHandTracker = new MotionTracker(); - private int combo; - private int score; + public int maxCombo; + public int combo; + public int score; + public int perfect, hit, miss; [SerializeField] private Transform HitEffectObjects; @@ -74,6 +76,8 @@ public class PlayEngine : SingletonBehaviour<PlayEngine> audioSource.clip = audioFile; audioSource.PlayScheduled(playOffset + dspTime); Debug.Log(playOffset); + + combo = maxCombo = score = miss = perfect = hit = 0; } void OnEnable() @@ -157,6 +161,13 @@ public class PlayEngine : SingletonBehaviour<PlayEngine> throw e; } } + + if (!audioSource.isPlaying) + { + level = null; + IngameUIManager.inst.UpdateResultUIs(perfect, hit, miss, score, combo); + IngameUIManager.inst.ChangeUISet(UISetType.RESULT); + } } if (Input.GetKeyDown(KeyCode.LeftArrow)) @@ -236,17 +247,32 @@ public class PlayEngine : SingletonBehaviour<PlayEngine> // Simple implementations of Combo, Score UIs // It needs to be changed if PlayEngine don't have any responsibilities of score & combo - public void HandleNoteJudge(JudgeType type) + public void HandleNoteJudge(JudgeResult result) { + JudgeType type = result.type; if (type == JudgeType.Ignore) return; combo = type != JudgeType.Miss ? combo + 1 : 0; - score += (int)type; + maxCombo = Mathf.Max(maxCombo, combo); + score += (int)type * (result.correctHand ? 2 : 1) + combo; IngameUIManager.inst.UpdateComboUI(combo); IngameUIManager.inst.UpdateScoreUI(score); - foreach (var renderer in HitEffectObjects.GetComponentsInChildren<MeshRenderer>()) + switch (type) + { + case JudgeType.Miss: + miss++; + break; + case JudgeType.Hit: + hit++; + break; + case JudgeType.Perfect: + perfect++; + break; + } + + foreach (var renderer in HitEffectObjects.GetComponentsInChildren<MeshRenderer>()) { Color col = Color.white; switch (type) diff --git a/RhythmKata/Assets/Scripts/ReloadNoteObject.cs b/RhythmKata/Assets/Scripts/ReloadNoteObject.cs index cafbf79ac32d690a7d2ad31994cd4a9d75ff6fb3..2984b29234f393a78b3108afa61d567696dc103d 100644 --- a/RhythmKata/Assets/Scripts/ReloadNoteObject.cs +++ b/RhythmKata/Assets/Scripts/ReloadNoteObject.cs @@ -34,7 +34,7 @@ public class ReloadNoteObject : NoteObject Instantiate(hitEffect, transform.position, Quaternion.identity); StartCoroutine(DissolveRoutine()); - PlayEngine.inst.HandleNoteJudge(judge.type); + PlayEngine.inst.HandleNoteJudge(judge); } }