Commit 6bd361a5 authored by 16이상민's avatar 16이상민

Fix motion guage logic

parent 79dd6896
...@@ -29,7 +29,7 @@ namespace JudgeModule ...@@ -29,7 +29,7 @@ namespace JudgeModule
public void JudgeNote(Note note, float timing) public void JudgeNote(Note note, float timing)
{ {
if (Judge.IsPastNote(note, timing) || if (Judge.IsPastNote(note, timing) ||
note.Component.transform.position.x > appear.transform.position.x) note.Component.transform.position.x > appear.transform.position.x)
return; return;
......
...@@ -6,34 +6,19 @@ namespace JudgeModule ...@@ -6,34 +6,19 @@ namespace JudgeModule
class MotionGageManager class MotionGageManager
{ {
public GameObject motionGuage; public GameObject motionGuage;
private float elapsedMotion;
private float motionTimeout;
private float elapsedTime = 0;
public void ResetGuage(float timeout = 0f) private float motionTimeout,
{ baseTime;
if (timeout <= 0f)
{
elapsedMotion = 0f;
motionGuage.transform.parent.gameObject.SetActive(false);
return;
}
motionTimeout = timeout; public void ResetGuage(float timeout = 0f, float basetime = 0f)
motionGuage.transform.parent.gameObject.SetActive(true);
motionGuage.SetActive(true);
}
public void UpdateGuage()
{ {
if (elapsedMotion >= motionTimeout) motionTimeout = timeout;
ResetGuage(); baseTime = basetime;
else motionGuage.transform.parent.gameObject.SetActive(timeout != 0f);
motionGuage.GetComponent<Image>().fillAmount = elapsedMotion / motionTimeout;
} }
public void UpdateGuage(float timing)
public void UpdateTime(float delta)
{ {
elapsedTime += delta; motionGuage.GetComponent<Image>().fillAmount = (timing - baseTime) / motionTimeout;
} }
} }
} }
...@@ -11,6 +11,7 @@ namespace JudgeModule ...@@ -11,6 +11,7 @@ namespace JudgeModule
private Action EndGame; private Action EndGame;
private GameObject judgeText; private GameObject judgeText;
private JudgeTextManager judgetextmanager; private JudgeTextManager judgetextmanager;
private MotionGageManager guage;
public NoteJudger(Dictionary<string, GameObject> obj, Action endgame) public NoteJudger(Dictionary<string, GameObject> obj, Action endgame)
{ {
...@@ -19,6 +20,8 @@ namespace JudgeModule ...@@ -19,6 +20,8 @@ namespace JudgeModule
EndGame = endgame; EndGame = endgame;
judgetextmanager = judgeText.GetComponent<JudgeTextManager>(); judgetextmanager = judgeText.GetComponent<JudgeTextManager>();
guage = new MotionGageManager { motionGuage = obj["guage"] };
guage.ResetGuage();
} }
public void WrongNoteProc(Note note) public void WrongNoteProc(Note note)
...@@ -40,7 +43,12 @@ namespace JudgeModule ...@@ -40,7 +43,12 @@ namespace JudgeModule
Debug.Log("Entered: " + timing + ", Judge: " + judge.Name); Debug.Log("Entered: " + timing + ", Judge: " + judge.Name);
if (note.IsLong && !judge.IsBreak) if (note.IsLong && !judge.IsBreak)
{
note.Activated = true; note.Activated = true;
if (note.Type == NoteType.LMO)
guage.ResetGuage(note.Length, timing);
}
else else
{ {
note.Component.Deactivate(deactives.transform, !note.IsLong); note.Component.Deactivate(deactives.transform, !note.IsLong);
...@@ -50,6 +58,7 @@ namespace JudgeModule ...@@ -50,6 +58,7 @@ namespace JudgeModule
public void ContinuingNoteProc(Note note, float timing, float interval) public void ContinuingNoteProc(Note note, float timing, float interval)
{ {
guage.UpdateGuage(timing);
if (Judge.IsNoteProgress(note, timing, interval)) if (Judge.IsNoteProgress(note, timing, interval))
{ {
Debug.Log("Continuing: " + timing); Debug.Log("Continuing: " + timing);
...@@ -61,6 +70,7 @@ namespace JudgeModule ...@@ -61,6 +70,7 @@ namespace JudgeModule
public void CorrectlyStoppedNoteProc(Note note, float timing) public void CorrectlyStoppedNoteProc(Note note, float timing)
{ {
guage.ResetGuage();
SetJudge(Judge.TestJudge(note, timing, true), judgeText); SetJudge(Judge.TestJudge(note, timing, true), judgeText);
judgetextmanager.Register(note); judgetextmanager.Register(note);
note.Component.Deactivate(deactives.transform); note.Component.Deactivate(deactives.transform);
...@@ -69,6 +79,7 @@ namespace JudgeModule ...@@ -69,6 +79,7 @@ namespace JudgeModule
public void IncorrectlyStoppedNoteProc(Note note) public void IncorrectlyStoppedNoteProc(Note note)
{ {
guage.ResetGuage();
SetJudge(Judge.MISS, judgeText); SetJudge(Judge.MISS, judgeText);
judgetextmanager.Register(note); judgetextmanager.Register(note);
note.Component.Deactivate(deactives.transform, false); note.Component.Deactivate(deactives.transform, false);
......
...@@ -88,6 +88,7 @@ LightmapSettings: ...@@ -88,6 +88,7 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1 m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0} m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1 m_UseShadowmask: 1
--- !u!196 &4 --- !u!196 &4
...@@ -136,7 +137,7 @@ RectTransform: ...@@ -136,7 +137,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 36226165} m_GameObject: {fileID: 36226165}
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: -1, 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: []
m_Father: {fileID: 785996772} m_Father: {fileID: 785996772}
...@@ -535,7 +536,7 @@ RectTransform: ...@@ -535,7 +536,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 295245169} m_GameObject: {fileID: 295245169}
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: -75, 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: 1152155867} - {fileID: 1152155867}
...@@ -1623,8 +1624,8 @@ RectTransform: ...@@ -1623,8 +1624,8 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 765048384} m_GameObject: {fileID: 765048384}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 523, y: 294, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0, y: 0, z: 0}
m_Children: m_Children:
- {fileID: 1073141667} - {fileID: 1073141667}
- {fileID: 1173591428} - {fileID: 1173591428}
...@@ -1982,7 +1983,7 @@ RectTransform: ...@@ -1982,7 +1983,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1073141666} m_GameObject: {fileID: 1073141666}
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: 294, 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: 785996772} - {fileID: 785996772}
...@@ -2149,7 +2150,7 @@ RectTransform: ...@@ -2149,7 +2150,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1152155866} m_GameObject: {fileID: 1152155866}
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: -90, 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: []
m_Father: {fileID: 295245170} m_Father: {fileID: 295245170}
...@@ -2331,7 +2332,7 @@ RectTransform: ...@@ -2331,7 +2332,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1173591427} m_GameObject: {fileID: 1173591427}
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: -94, 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: 1665813939} - {fileID: 1665813939}
...@@ -2340,8 +2341,8 @@ RectTransform: ...@@ -2340,8 +2341,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0} m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 200} m_AnchoredPosition: {x: 0, y: 77}
m_SizeDelta: {x: 200, y: 200} m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1173591430 --- !u!114 &1173591430
MonoBehaviour: MonoBehaviour:
...@@ -2527,6 +2528,7 @@ Camera: ...@@ -2527,6 +2528,7 @@ Camera:
m_TargetEye: 3 m_TargetEye: 3
m_HDR: 1 m_HDR: 1
m_AllowMSAA: 1 m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0 m_ForceIntoRT: 0
m_OcclusionCulling: 1 m_OcclusionCulling: 1
m_StereoConvergence: 10 m_StereoConvergence: 10
...@@ -2631,7 +2633,7 @@ RectTransform: ...@@ -2631,7 +2633,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1299260532} m_GameObject: {fileID: 1299260532}
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: -151, 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: []
m_Father: {fileID: 785996772} m_Father: {fileID: 785996772}
...@@ -2959,7 +2961,7 @@ RectTransform: ...@@ -2959,7 +2961,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1463464316} m_GameObject: {fileID: 1463464316}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -486.5, 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: []
m_Father: {fileID: 295245170} m_Father: {fileID: 295245170}
...@@ -3235,7 +3237,7 @@ RectTransform: ...@@ -3235,7 +3237,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1669651589} m_GameObject: {fileID: 1669651589}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 488.5, 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: []
m_Father: {fileID: 295245170} m_Father: {fileID: 295245170}
...@@ -3270,7 +3272,7 @@ RectTransform: ...@@ -3270,7 +3272,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1681188542} m_GameObject: {fileID: 1681188542}
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: -101, 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: []
m_Father: {fileID: 785996772} m_Father: {fileID: 785996772}
...@@ -3613,7 +3615,7 @@ RectTransform: ...@@ -3613,7 +3615,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1852280156} m_GameObject: {fileID: 1852280156}
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: -51, 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: []
m_Father: {fileID: 785996772} m_Father: {fileID: 785996772}
...@@ -3847,7 +3849,7 @@ RectTransform: ...@@ -3847,7 +3849,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2001722606} m_GameObject: {fileID: 2001722606}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1.5, 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: 791052775} - {fileID: 791052775}
...@@ -3975,9 +3977,9 @@ MeshCollider: ...@@ -3975,9 +3977,9 @@ MeshCollider:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 3
m_Convex: 0 m_Convex: 0
m_InflateMesh: 0 m_CookingOptions: 14
m_SkinWidth: 0.01 m_SkinWidth: 0.01
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &2093461956 --- !u!33 &2093461956
......
...@@ -19,8 +19,6 @@ public class InGameManager : MonoBehaviour ...@@ -19,8 +19,6 @@ public class InGameManager : MonoBehaviour
disappear, disappear,
judgetext, judgetext,
motionSampleDisplayPrefab; motionSampleDisplayPrefab;
private MotionGageManager motionGageManager;
private InputManager input; private InputManager input;
private NoteManager notemanager; private NoteManager notemanager;
...@@ -60,9 +58,6 @@ public class InGameManager : MonoBehaviour ...@@ -60,9 +58,6 @@ public class InGameManager : MonoBehaviour
ShowResult, ShowResult,
objects, objects,
GameManager.Instance.CurrentTrack.BPM); GameManager.Instance.CurrentTrack.BPM);
motionGageManager = new MotionGageManager
{ motionGuage = GameObject.Find("Motion Guage") };
} }
private void SetObjectRef() private void SetObjectRef()
...@@ -73,8 +68,7 @@ public class InGameManager : MonoBehaviour ...@@ -73,8 +68,7 @@ public class InGameManager : MonoBehaviour
appear = GameObject.Find("AppearNote"); appear = GameObject.Find("AppearNote");
disappear = GameObject.Find("DisappearNote"); disappear = GameObject.Find("DisappearNote");
judgetext = GameObject.Find("Judge"); judgetext = GameObject.Find("Judge");
input = GameObject.Find("InGameManagers") input = GetComponent<InputManager>();
.GetComponent<InputManager>();
motionSampleDisplayPrefab = Resources.Load("Motion Sample Display") motionSampleDisplayPrefab = Resources.Load("Motion Sample Display")
as GameObject; as GameObject;
...@@ -89,14 +83,14 @@ public class InGameManager : MonoBehaviour ...@@ -89,14 +83,14 @@ public class InGameManager : MonoBehaviour
{ "appear", appear }, { "appear", appear },
{ "disappear", disappear }, { "disappear", disappear },
{ "judgetext", judgetext }, { "judgetext", judgetext },
{ "sample", motionSampleDisplayPrefab } { "sample", motionSampleDisplayPrefab },
{ "guage", GameObject.Find("Motion Guage") }
}); });
} }
private void JudgeInit() private void JudgeInit()
{ {
judgetext.SetActive(false); judgetext.SetActive(false);
motionGageManager.ResetGuage();
baseTime = 0f; baseTime = 0f;
IsInitTime = false; IsInitTime = false;
delayBase = (appear.transform.position.x - offset.transform.position.x) delayBase = (appear.transform.position.x - offset.transform.position.x)
...@@ -131,10 +125,7 @@ public class InGameManager : MonoBehaviour ...@@ -131,10 +125,7 @@ public class InGameManager : MonoBehaviour
} }
float timing = current - baseTime - delayBase - delay; float timing = current - baseTime - delayBase - delay;
motionGageManager.UpdateTime(Time.deltaTime * 1000);
motionGageManager.UpdateGuage();
notemanager.Controll(timing); notemanager.Controll(timing);
if (notemanager.IsEnd) if (notemanager.IsEnd)
......
m_EditorVersion: 2017.2.0f3 m_EditorVersion: 2017.3.0f3
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