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
390a0c5b
Commit
390a0c5b
authored
Nov 14, 2019
by
lokanchung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
기본 판정 시스템 구현
parent
f79dc081
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
70 deletions
+50
-70
DefaultNote.prefab
RhythmKata/Assets/Prefabs/DefaultNote.prefab
+2
-50
Level.cs
RhythmKata/Assets/Scripts/Core/Level.cs
+1
-2
Note.cs
RhythmKata/Assets/Scripts/Core/Note.cs
+8
-4
NoteObject.cs
RhythmKata/Assets/Scripts/NoteObject.cs
+21
-2
PlayEngine.cs
RhythmKata/Assets/Scripts/PlayEngine.cs
+18
-12
No files found.
RhythmKata/Assets/Prefabs/DefaultNote.prefab
View file @
390a0c5b
...
...
@@ -121,7 +121,7 @@ Transform:
m_GameObject
:
{
fileID
:
8354046899824507571
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
10
}
m_LocalScale
:
{
x
:
3
,
y
:
3
,
z
:
3
}
m_LocalScale
:
{
x
:
5
,
y
:
5
,
z
:
5
}
m_Children
:
-
{
fileID
:
2824711142497691445
}
m_Father
:
{
fileID
:
0
}
...
...
@@ -184,7 +184,7 @@ SphereCollider:
m_IsTrigger
:
0
m_Enabled
:
1
serializedVersion
:
2
m_Radius
:
0.5
m_Radius
:
0.
7
5
m_Center
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&8354046899824507576
MonoBehaviour
:
...
...
@@ -198,54 +198,6 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
5ede6b16436a58b4bb3118a59fd1a9ba
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
curveX
:
serializedVersion
:
2
m_Curve
:
-
serializedVersion
:
3
time
:
0
value
:
0
inSlope
:
1
outSlope
:
1
tangentMode
:
34
weightedMode
:
0
inWeight
:
0
outWeight
:
0
-
serializedVersion
:
3
time
:
1
value
:
1
inSlope
:
1
outSlope
:
1
tangentMode
:
34
weightedMode
:
0
inWeight
:
0
outWeight
:
0
m_PreInfinity
:
2
m_PostInfinity
:
2
m_RotationOrder
:
4
curveY
:
serializedVersion
:
2
m_Curve
:
-
serializedVersion
:
3
time
:
0
value
:
0
inSlope
:
1
outSlope
:
1
tangentMode
:
34
weightedMode
:
0
inWeight
:
0
outWeight
:
0
-
serializedVersion
:
3
time
:
1
value
:
1
inSlope
:
1
outSlope
:
1
tangentMode
:
34
weightedMode
:
0
inWeight
:
0
outWeight
:
0
m_PreInfinity
:
2
m_PostInfinity
:
2
m_RotationOrder
:
4
endPoint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
maxRemainedTime
:
1
perfectZ
:
10
...
...
RhythmKata/Assets/Scripts/Core/Level.cs
View file @
390a0c5b
...
...
@@ -20,10 +20,9 @@ class Level
var
judge
=
new
JudgeResult
();
var
hit
=
note
.
CheckHit
(
input
.
ray
);
Debug
.
Log
(
input
.
ray
);
judge
.
near
=
false
;
judge
.
type
=
JudgeType
.
Ignore
;
judge
.
correctHand
=
note
.
HandType
==
HandType
.
None
||
note
.
HandType
==
input
.
hand
;
switch
(
hit
)
{
...
...
RhythmKata/Assets/Scripts/Core/Note.cs
View file @
390a0c5b
...
...
@@ -33,14 +33,14 @@ abstract class Note
var
timing
=
Math
.
Abs
(
delta
);
var
early
=
delta
<
0
;
if
(
timing
<
0.
5
)
if
(
timing
<
0.
1
)
{
return
JudgeType
.
Perfect
;
}
else
if
(
timing
<
1.0
)
else
if
(
timing
<
0.5
)
{
return
JudgeType
.
Hit
;
}
else
if
(
timing
<
1.
5
&&
early
)
}
else
if
(
timing
<
1.
0
&&
early
)
{
return
JudgeType
.
Miss
;
}
...
...
@@ -67,7 +67,11 @@ abstract class Note
{
if
(
judge
.
type
!=
JudgeType
.
Ignore
)
{
Debug
.
Log
(
System
.
Enum
.
GetName
(
typeof
(
JudgeType
),
judge
.
type
));
Debug
.
Log
(
string
.
Format
(
"Note #{0}: {1}, Correct Hand: {2}"
,
0
,
System
.
Enum
.
GetName
(
typeof
(
JudgeType
),
judge
.
type
),
judge
.
correctHand
));
noteObject
.
NoteHit
(
judge
);
}
}
...
...
RhythmKata/Assets/Scripts/NoteObject.cs
View file @
390a0c5b
...
...
@@ -28,9 +28,28 @@ public abstract class NoteObject : MonoBehaviour
public
virtual
void
NoteHit
(
JudgeResult
judge
)
{
GameObject
hitEffect
=
null
;
if
(
judge
.
type
==
JudgeType
.
Perfect
)
hitEffect
=
PlayEngine
.
inst
.
hitEffectPrefabs
[
0
];
if
(
judge
.
type
==
JudgeType
.
Hit
)
hitEffect
=
PlayEngine
.
inst
.
hitEffectPrefabs
[
1
];
if
(
judge
.
type
==
JudgeType
.
Miss
)
hitEffect
=
PlayEngine
.
inst
.
hitEffectPrefabs
[
2
];
OnNoteHit
?.
Invoke
(
judge
);
Instantiate
(
PlayEngine
.
inst
.
hitEffectPrefabs
[(
int
)(
judge
.
type
)],
transform
.
position
,
Quaternion
.
identity
);
//Destroy(gameObject);
if
(
hitEffect
&&
judge
.
type
!=
JudgeType
.
Ignore
)
{
// show explosion effect
Instantiate
(
hitEffect
,
transform
.
position
,
Quaternion
.
identity
);
// TODO: temporary implementation
// make note invisible
var
meshRenderer
=
gameObject
.
GetComponent
<
MeshRenderer
>();
var
trailRenderer
=
gameObject
.
GetComponent
<
TrailRenderer
>();
if
(
meshRenderer
)
meshRenderer
.
enabled
=
false
;
if
(
trailRenderer
)
trailRenderer
.
enabled
=
false
;
}
}
public
virtual
void
SetPosition
(
float
remainedTime
)
...
...
RhythmKata/Assets/Scripts/PlayEngine.cs
View file @
390a0c5b
...
...
@@ -75,23 +75,29 @@ public class PlayEngine : SingletonBehaviour<PlayEngine>
PlayerInput
input
=
new
PlayerInput
();
input
.
time
=
playbackTime
;
// FIXME: fire.GetStateDown causes error
if
(
Input
.
GetKeyDown
(
KeyCode
.
Alpha1
))
{
input
.
ray
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
input
.
hand
=
HandType
.
Left
;
level
.
HandleInput
(
input
);
}
if
(
Input
.
GetKeyDown
(
KeyCode
.
Alpha2
))
{
input
.
ray
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
input
.
hand
=
HandType
.
Left
;
level
.
HandleInput
(
input
);
}
try
// when no VR device is available, SteamVR causes an error.
{
if
(
Input
.
GetMouseButtonDown
(
0
)
||
fire
.
GetStateDown
(
leftHand
))
// TODO: handle vr input
if
(
fire
.
GetStateDown
(
leftHand
))
{
AudioSource
.
PlayClipAtPoint
(
gunSfx
,
Vector3
.
zero
);
input
.
ray
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
Debug
.
DrawRay
(
input
.
ray
.
origin
,
input
.
ray
.
direction
*
10
,
Color
.
yellow
);
input
.
hand
=
HandType
.
Left
;
level
.
HandleInput
(
input
);
}
if
(
Input
.
GetMouseButtonDown
(
1
)
||
fire
.
GetStateDown
(
rightHand
))
if
(
fire
.
GetStateDown
(
rightHand
))
{
AudioSource
.
PlayClipAtPoint
(
gunSfx
,
Vector3
.
zero
);
input
.
ray
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
input
.
hand
=
HandType
.
Right
;
level
.
HandleInput
(
input
);
}
}
catch
(
NullReferenceException
e
)
...
...
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