Commit d99b97ff authored by 16이상민's avatar 16이상민

Add combo text

parent 5c6b284f
...@@ -10,7 +10,8 @@ namespace JudgeModule ...@@ -10,7 +10,8 @@ namespace JudgeModule
private Transform deactives; private Transform deactives;
private Action EndGame; private Action EndGame;
private GameObject judgeText, private GameObject judgeText,
firework; firework,
combo;
private JudgeTextManager judgetextmanager; private JudgeTextManager judgetextmanager;
private MotionGageManager guage; private MotionGageManager guage;
...@@ -19,6 +20,7 @@ namespace JudgeModule ...@@ -19,6 +20,7 @@ namespace JudgeModule
deactives = obj["deactives"].transform; deactives = obj["deactives"].transform;
judgeText = obj["judgetext"]; judgeText = obj["judgetext"];
firework = obj["firework"]; firework = obj["firework"];
combo = obj["combo"];
EndGame = endgame; EndGame = endgame;
judgetextmanager = judgeText.GetComponent<JudgeTextManager>(); judgetextmanager = judgeText.GetComponent<JudgeTextManager>();
...@@ -28,7 +30,7 @@ namespace JudgeModule ...@@ -28,7 +30,7 @@ namespace JudgeModule
public void WrongNoteProc(Note note) public void WrongNoteProc(Note note)
{ {
SetJudge(Judge.MISS, judgeText, firework); SetJudge(Judge.MISS, judgeText, firework, combo);
note.Component.Deactivate(deactives.transform); note.Component.Deactivate(deactives.transform);
if (!(note is MotionNote)) if (!(note is MotionNote))
...@@ -39,7 +41,7 @@ namespace JudgeModule ...@@ -39,7 +41,7 @@ namespace JudgeModule
{ {
var judge = Judge.TestJudge(note, timing); var judge = Judge.TestJudge(note, timing);
SetJudge(judge, judgeText, firework); SetJudge(judge, judgeText, firework, combo);
judgetextmanager.Register(note); judgetextmanager.Register(note);
Debug.Log("Entered: " + timing + ", Judge: " + judge.Name); Debug.Log("Entered: " + timing + ", Judge: " + judge.Name);
...@@ -64,7 +66,7 @@ namespace JudgeModule ...@@ -64,7 +66,7 @@ namespace JudgeModule
if (Judge.IsNoteProgress(note, timing, interval)) if (Judge.IsNoteProgress(note, timing, interval))
{ {
Debug.Log("Continuing: " + timing); Debug.Log("Continuing: " + timing);
SetJudge(Judge.Perfect, judgeText, firework); SetJudge(Judge.Perfect, judgeText, firework, combo);
judgetextmanager.Register(note); judgetextmanager.Register(note);
++note.JudgeCount; ++note.JudgeCount;
} }
...@@ -73,7 +75,7 @@ namespace JudgeModule ...@@ -73,7 +75,7 @@ namespace JudgeModule
public void CorrectlyStoppedNoteProc(Note note, float timing) public void CorrectlyStoppedNoteProc(Note note, float timing)
{ {
guage.ResetGuage(); guage.ResetGuage();
SetJudge(Judge.TestJudge(note, timing, true), judgeText, firework); SetJudge(Judge.TestJudge(note, timing, true), judgeText, firework, combo);
judgetextmanager.Register(note); judgetextmanager.Register(note);
note.Component.Deactivate(deactives.transform); note.Component.Deactivate(deactives.transform);
judgetextmanager.UnRegister(); judgetextmanager.UnRegister();
...@@ -82,25 +84,33 @@ namespace JudgeModule ...@@ -82,25 +84,33 @@ namespace JudgeModule
public void IncorrectlyStoppedNoteProc(Note note) public void IncorrectlyStoppedNoteProc(Note note)
{ {
guage.ResetGuage(); guage.ResetGuage();
SetJudge(Judge.MISS, judgeText, firework); SetJudge(Judge.MISS, judgeText, firework, combo);
judgetextmanager.Register(note); judgetextmanager.Register(note);
note.Component.Deactivate(deactives.transform, false); note.Component.Deactivate(deactives.transform, false);
judgetextmanager.UnRegister(); judgetextmanager.UnRegister();
} }
public static void SetJudge(Judge judge, GameObject judgeText, GameObject firework) public static void SetJudge(Judge judge, GameObject judgeText, GameObject firework, GameObject combo)
{ {
AllSceneManager.Combo = judge.IsBreak ? 0 : AllSceneManager.Combo + 1; AllSceneManager.Combo = judge.IsBreak ? 0 : AllSceneManager.Combo + 1;
AllSceneManager.Score += judge.Score; AllSceneManager.Score += judge.Score;
AllSceneManager.JudgeCount[judge]++; AllSceneManager.JudgeCount[judge]++;
if (AllSceneManager.Combo > 0 && if (AllSceneManager.Combo > 0 &&
AllSceneManager.Combo % 4 == 0) AllSceneManager.Combo % 10 == 0)
{ {
firework.GetComponent<FireworkManager>().timeout += 2; firework.GetComponent<FireworkManager>().timeout += 2;
firework.SetActive(true); firework.SetActive(true);
} }
if (AllSceneManager.Combo > 1)
{
combo.GetComponent<Text>().text = AllSceneManager.Combo.ToString();
combo.SetActive(true);
}
else if (AllSceneManager.Combo == 0)
combo.SetActive(false);
judgeText.SetActive(false); judgeText.SetActive(false);
judgeText.SetActive(true); judgeText.SetActive(true);
judgeText.GetComponent<Text>().text = judge.Name; judgeText.GetComponent<Text>().text = judge.Name;
......
...@@ -13,7 +13,8 @@ namespace JudgeModule ...@@ -13,7 +13,8 @@ namespace JudgeModule
appear, appear,
disappear, disappear,
judgetext, judgetext,
firework; firework,
combo;
private JudgeTextManager judgetextmanager; private JudgeTextManager judgetextmanager;
...@@ -104,6 +105,7 @@ namespace JudgeModule ...@@ -104,6 +105,7 @@ namespace JudgeModule
disappear = gameObjects["disappear"]; disappear = gameObjects["disappear"];
judgetext = gameObjects["judgetext"]; judgetext = gameObjects["judgetext"];
firework = gameObjects["firework"]; firework = gameObjects["firework"];
combo = gameObjects["combo"];
judgetextmanager = judgetext.GetComponent<JudgeTextManager>(); judgetextmanager = judgetext.GetComponent<JudgeTextManager>();
...@@ -156,7 +158,7 @@ namespace JudgeModule ...@@ -156,7 +158,7 @@ namespace JudgeModule
!judgetextmanager.IsRegistered(c.Instance) && !judgetextmanager.IsRegistered(c.Instance) &&
initialPos.x - c.StartPosition() > Judge.BAD.TimingRange(c.Instance)) initialPos.x - c.StartPosition() > Judge.BAD.TimingRange(c.Instance))
{ {
NoteJudger.SetJudge(Judge.MISS, judgetext, firework); NoteJudger.SetJudge(Judge.MISS, judgetext, firework, combo);
judgetextmanager.Register(c.Instance); judgetextmanager.Register(c.Instance);
c.Deactivate(deactives.transform, !c.Instance.IsLong); c.Deactivate(deactives.transform, !c.Instance.IsLong);
} }
......
...@@ -1083,6 +1083,80 @@ RectTransform: ...@@ -1083,6 +1083,80 @@ RectTransform:
Transform: Transform:
m_PrefabParentObject: {fileID: 400004, guid: 4428a4d47b3582c4b90ee7163c0223da, type: 3} m_PrefabParentObject: {fileID: 400004, guid: 4428a4d47b3582c4b90ee7163c0223da, type: 3}
m_PrefabInternal: {fileID: 1166755151} m_PrefabInternal: {fileID: 1166755151}
--- !u!1 &616344850
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 616344851}
- component: {fileID: 616344854}
- component: {fileID: 616344853}
m_Layer: 5
m_Name: Combo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &616344851
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 616344850}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1152155867}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: -14}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &616344853
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 616344850}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 20
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 0
--- !u!222 &616344854
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 616344850}
--- !u!4 &626936879 stripped --- !u!4 &626936879 stripped
Transform: Transform:
m_PrefabParentObject: {fileID: 400004, guid: 4428a4d47b3582c4b90ee7163c0223da, type: 3} m_PrefabParentObject: {fileID: 400004, guid: 4428a4d47b3582c4b90ee7163c0223da, type: 3}
...@@ -2152,7 +2226,8 @@ RectTransform: ...@@ -2152,7 +2226,8 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children:
- {fileID: 616344851}
m_Father: {fileID: 295245170} m_Father: {fileID: 295245170}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
...@@ -2436,6 +2511,7 @@ MonoBehaviour: ...@@ -2436,6 +2511,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
FireworkFX_1: {fileID: 1359478573} FireworkFX_1: {fileID: 1359478573}
FireworkFX_2: {fileID: 1432184524} FireworkFX_2: {fileID: 1432184524}
timeout: 0
--- !u!1 &1199323771 --- !u!1 &1199323771
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -71,6 +71,8 @@ public class InGameManager : MonoBehaviour ...@@ -71,6 +71,8 @@ public class InGameManager : MonoBehaviour
input = GetComponent<InputManager>(); input = GetComponent<InputManager>();
var firework = GameObject.Find("Firework"); var firework = GameObject.Find("Firework");
firework.SetActive(false); firework.SetActive(false);
var combo = GameObject.Find("Combo");
combo.SetActive(false);
motionSampleDisplayPrefab = Resources.Load("Motion Sample Display") motionSampleDisplayPrefab = Resources.Load("Motion Sample Display")
as GameObject; as GameObject;
...@@ -87,7 +89,8 @@ public class InGameManager : MonoBehaviour ...@@ -87,7 +89,8 @@ public class InGameManager : MonoBehaviour
{ "judgetext", judgetext }, { "judgetext", judgetext },
{ "sample", motionSampleDisplayPrefab }, { "sample", motionSampleDisplayPrefab },
{ "guage", GameObject.Find("Motion Guage") }, { "guage", GameObject.Find("Motion Guage") },
{ "firework", firework } { "firework", firework },
{ "combo", combo }
}); });
} }
......
...@@ -4,16 +4,10 @@ using UnityEngine.UI; ...@@ -4,16 +4,10 @@ using UnityEngine.UI;
public class JudgeTextManager : MonoBehaviour public class JudgeTextManager : MonoBehaviour
{ {
private float start; private float start;
private Text text;
private NoteType type; private NoteType type;
private float startTiming, endTiming; private float startTiming, endTiming;
private void Start()
{
text = gameObject.GetComponent<Text>();
}
private void OnEnable() private void OnEnable()
{ {
start = Time.time; start = Time.time;
......
...@@ -28,7 +28,7 @@ public class NoteJudgerTests ...@@ -28,7 +28,7 @@ public class NoteJudgerTests
{ {
yield return null; yield return null;
NoteJudger.SetJudge(x, settings.judge, null); NoteJudger.SetJudge(x, settings.judge, null, null);
if (text.text == x.Name && if (text.text == x.Name &&
text.color == x.Color) text.color == x.Color)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment