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

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

parent 390a0c5b
......@@ -18,4 +18,11 @@ public struct JudgeResult
public JudgeType type;
public bool correctHand;
public bool near;
public JudgeResult(JudgeType type)
{
this.type = type;
correctHand = false;
near = false;
}
}
\ No newline at end of file
......@@ -15,37 +15,49 @@ class Level
{
foreach(var note in notes)
{
if (note.Active)
if (note.IsActive)
{
var judge = new JudgeResult();
var hit = note.CheckHit(input.ray);
JudgeResult judge = Judge(input, note);
judge.near = false;
judge.type = JudgeType.Ignore;
judge.correctHand = note.HandType == HandType.None || note.HandType == input.hand;
switch (hit)
if (judge.type != JudgeType.Ignore)
{
case HitType.Hit:
judge.type = note.JudgeTiming(input.time);
break;
case HitType.Near:
if (note.JudgeTiming(input.time) >= JudgeType.Hit)
{
judge.type = JudgeType.Miss;
}
judge.near = true;
break;
case HitType.Miss:
judge.near = false;
break;
note.Deactivate();
}
note.HandleJudge(judge);
}
}
}
private JudgeResult Judge(PlayerInput input, Note note)
{
var judge = new JudgeResult();
var hit = note.CheckHit(input.ray);
judge.near = false;
judge.type = JudgeType.Ignore;
judge.correctHand = note.HandType == HandType.None || note.HandType == input.hand;
switch (hit)
{
case HitType.Hit:
judge.type = note.JudgeTiming(input.time);
break;
case HitType.Near:
if (note.JudgeTiming(input.time) >= JudgeType.Hit)
{
judge.type = JudgeType.Miss;
}
judge.near = true;
break;
case HitType.Miss:
judge.near = false;
break;
}
return judge;
}
public void UpdateNotes(double time)
{
foreach (var note in notes)
......
......@@ -12,15 +12,29 @@ abstract class Note
protected Level level;
protected NoteObject noteObject;
// get only, make this into property?
public bool Active;
private bool isVisible = true;
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
protected abstract void FromBmsNum(String num);
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()
{
noteObject = CreateNoteObjectImpl();
......@@ -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_HIDE_TIMING = -2;
private static readonly float NOTE_MISS_TIMING = -0.5f;
private static readonly float NOTE_POSITION_MULTIPLIER = 2;
public void Update(float remainingTime)
{
if (remainingTime < NOTE_HIDE_TIMING || remainingTime > NOTE_SHOW_TIMING)
{
noteObject.gameObject.SetActive(false);
Active = false;
isVisible = false;
}
else
{
Active = 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);
......
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