Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RhythmKata
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
13정준영
RhythmKata
Commits
25963196
Commit
25963196
authored
Nov 14, 2019
by
13정준영
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Miss 추가, (간접미스, 시간초과)
parent
390a0c5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
28 deletions
+68
-28
Judge.cs
RhythmKata/Assets/Scripts/Core/Judge.cs
+7
-0
Level.cs
RhythmKata/Assets/Scripts/Core/Level.cs
+34
-22
Note.cs
RhythmKata/Assets/Scripts/Core/Note.cs
+27
-6
No files found.
RhythmKata/Assets/Scripts/Core/Judge.cs
View file @
25963196
...
@@ -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
RhythmKata/Assets/Scripts/Core/Level.cs
View file @
25963196
...
@@ -15,37 +15,49 @@ class Level
...
@@ -15,37 +15,49 @@ class Level
{
{
foreach
(
var
note
in
notes
)
foreach
(
var
note
in
notes
)
{
{
if
(
note
.
Active
)
if
(
note
.
Is
Active
)
{
{
var
judge
=
new
JudgeResult
();
JudgeResult
judge
=
Judge
(
input
,
note
);
var
hit
=
note
.
CheckHit
(
input
.
ray
);
judge
.
near
=
false
;
if
(
judge
.
type
!=
JudgeType
.
Ignore
)
judge
.
type
=
JudgeType
.
Ignore
;
judge
.
correctHand
=
note
.
HandType
==
HandType
.
None
||
note
.
HandType
==
input
.
hand
;
switch
(
hit
)
{
{
case
HitType
.
Hit
:
note
.
Deactivate
();
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
.
HandleJudge
(
judge
);
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
)
public
void
UpdateNotes
(
double
time
)
{
{
foreach
(
var
note
in
notes
)
foreach
(
var
note
in
notes
)
...
...
RhythmKata/Assets/Scripts/Core/Note.cs
View file @
25963196
...
@@ -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: Refactor
t
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
);
Activ
e
=
false
;
isVisibl
e
=
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment