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
1e35be9b
Commit
1e35be9b
authored
Nov 13, 2019
by
15박보승
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NoteObject가 hit 되었는지 판정하는 isHit 구현
parent
31e9a1e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
EdgeNoteObject.cs
RhythmKata/Assets/Scripts/EdgeNoteObject.cs
+7
-1
ForwardNoteObject.cs
RhythmKata/Assets/Scripts/ForwardNoteObject.cs
+6
-0
NoteObject.cs
RhythmKata/Assets/Scripts/NoteObject.cs
+2
-0
No files found.
RhythmKata/Assets/Scripts/EdgeNoteObject.cs
View file @
1e35be9b
...
...
@@ -4,7 +4,8 @@ using UnityEngine;
public
class
EdgeNoteObject
:
NoteObject
{
Vector2
direction
;
[
SerializeField
]
private
Vector3
direction
;
public
void
Init
(
HandType
hand
)
{
Material
mat
=
GetComponent
<
Renderer
>().
material
;
...
...
@@ -29,4 +30,9 @@ public class EdgeNoteObject : NoteObject
{
transform
.
position
=
Vector3
.
Lerp
(
endPoint
,
endPoint
+
new
Vector3
(
0
,
0
,
200
),
remainedTime
/
maxRemainedTime
);
}
public
override
bool
IsHit
(
Ray
ray
)
{
return
Mathf
.
Abs
(
Mathf
.
Acos
(
Vector3
.
Dot
(
direction
.
normalized
,
ray
.
direction
)))
<
30
;
}
}
\ No newline at end of file
RhythmKata/Assets/Scripts/ForwardNoteObject.cs
View file @
1e35be9b
...
...
@@ -83,4 +83,10 @@ public class ForwardNoteObject : NoteObject
color
.
a
=
1f
-
Mathf
.
Clamp
(
remainedTime
/
maxRemainedTime
,
0
,
1
);
img
.
color
=
color
;
}
public
override
bool
IsHit
(
Ray
ray
)
{
RaycastHit
hit
;
return
GetComponent
<
Collider
>().
Raycast
(
ray
,
out
hit
,
40
);
}
}
RhythmKata/Assets/Scripts/NoteObject.cs
View file @
1e35be9b
...
...
@@ -45,4 +45,6 @@ public abstract class NoteObject : MonoBehaviour
{
transform
.
position
=
endPoint
+
new
Vector3
(
0
,
0
,
50
)
*
remainedTime
/
maxRemainedTime
;
}
public
abstract
bool
IsHit
(
Ray
ray
);
}
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