Commit 25963196 authored by 13정준영's avatar 13정준영

Miss 추가, (간접미스, 시간초과)

parent 390a0c5b
...@@ -18,4 +18,11 @@ public struct JudgeResult ...@@ -18,4 +18,11 @@ public struct JudgeResult
public JudgeType type; public JudgeType type;
public bool correctHand; public bool correctHand;
public bool near; public bool near;
public JudgeResult(JudgeType type)
{
this.type = type;
correctHand = false;
near = false;
}
} }
\ No newline at end of file
...@@ -15,7 +15,21 @@ class Level ...@@ -15,7 +15,21 @@ class Level
{ {
foreach(var note in notes) foreach(var note in notes)
{ {
if (note.Active) if (note.IsActive)
{
JudgeResult judge = Judge(input, note);
if (judge.type != JudgeType.Ignore)
{
note.Deactivate();
}
note.HandleJudge(judge);
}
}
}
private JudgeResult Judge(PlayerInput input, Note note)
{ {
var judge = new JudgeResult(); var judge = new JudgeResult();
var hit = note.CheckHit(input.ray); var hit = note.CheckHit(input.ray);
...@@ -41,9 +55,7 @@ class Level ...@@ -41,9 +55,7 @@ class Level
break; break;
} }
note.HandleJudge(judge); return judge;
}
}
} }
public void UpdateNotes(double time) public void UpdateNotes(double time)
......
...@@ -12,15 +12,29 @@ abstract class Note ...@@ -12,15 +12,29 @@ abstract class Note
protected Level level; protected Level level;
protected NoteObject noteObject; protected NoteObject noteObject;
// get only, make this into property? private bool isVisible = true;
public bool Active; private bool isActive = true;
public bool IsActive { get => isActive; } // judegement is active (not hit yet)
public bool IsVisible { get => isVisible; } // note is visible
// interpret note option // interpret note option
protected abstract void FromBmsNum(String num); protected abstract void FromBmsNum(String num);
protected abstract NoteObject CreateNoteObjectImpl(); protected abstract NoteObject CreateNoteObjectImpl();
// instantiate associated game object public void Activate()
{
isActive = true;
}
public void Deactivate()
{
isActive = false;
}
// instantiate associated game object
public void CreateNoteObject() public void CreateNoteObject()
{ {
noteObject = CreateNoteObjectImpl(); noteObject = CreateNoteObjectImpl();
...@@ -77,21 +91,28 @@ abstract class Note ...@@ -77,21 +91,28 @@ abstract class Note
} }
// TODO: Refactort this // TODO: Refactor this
private static readonly float NOTE_SHOW_TIMING = 5; private static readonly float NOTE_SHOW_TIMING = 5;
private static readonly float NOTE_HIDE_TIMING = -2; private static readonly float NOTE_HIDE_TIMING = -2;
private static readonly float NOTE_MISS_TIMING = -0.5f;
private static readonly float NOTE_POSITION_MULTIPLIER = 2; private static readonly float NOTE_POSITION_MULTIPLIER = 2;
public void Update(float remainingTime) public void Update(float remainingTime)
{ {
if (remainingTime < NOTE_HIDE_TIMING || remainingTime > NOTE_SHOW_TIMING) if (remainingTime < NOTE_HIDE_TIMING || remainingTime > NOTE_SHOW_TIMING)
{ {
noteObject.gameObject.SetActive(false); noteObject.gameObject.SetActive(false);
Active = false; isVisible = false;
} }
else else
{ {
Active = true;
noteObject.gameObject.SetActive(true); noteObject.gameObject.SetActive(true);
isVisible = true;
}
if (remainingTime < NOTE_MISS_TIMING && isActive && isVisible)
{
HandleJudge(new JudgeResult(JudgeType.Miss));
Deactivate();
} }
noteObject.SetPosition(remainingTime/NOTE_SHOW_TIMING * NOTE_POSITION_MULTIPLIER); noteObject.SetPosition(remainingTime/NOTE_SHOW_TIMING * NOTE_POSITION_MULTIPLIER);
......
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