Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
ButtonPusher
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
Button Pusher
ButtonPusher
Commits
97d54097
Commit
97d54097
authored
Jan 21, 2018
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring & Previous code integration complete
parent
ea1802aa
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
562 additions
and
227 deletions
+562
-227
Guard.cs
Assets/MotionNotes/Guard.cs
+5
-5
HandDown.cs
Assets/MotionNotes/HandDown.cs
+6
-6
HandUp.cs
Assets/MotionNotes/HandUp.cs
+6
-6
Headphone.cs
Assets/MotionNotes/Headphone.cs
+5
-5
PushUp.cs
Assets/MotionNotes/PushUp.cs
+21
-3
InputManager.cs
Assets/Script/InputManager.cs
+286
-16
Judge.cs
Assets/Script/Judge.cs
+4
-10
JudgeManager.cs
Assets/Script/JudgeManager.cs
+175
-147
MotionView.cs
Assets/Script/MotionView.cs
+10
-16
TrackManager.cs
Assets/Script/TrackManager.cs
+44
-13
No files found.
Assets/MotionNotes/Guard.cs
View file @
97d54097
...
...
@@ -24,23 +24,23 @@ public class Guard : MotionNote
{
case
"BG"
:
hand
=
Hand
.
Both
;
image
=
LoadNewSprite
(
"
BG
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/BG.png
"
);
prepare
=
MotionState
.
GUARD_BASE_LEFT
|
MotionState
.
GUARD_BASE_RIGHT
|
MotionState
.
HAND_MOVE_DOWN_LEFT
|
MotionState
.
HAND_MOVE_DOWN_RIGHT
;
done
=
MotionState
.
GUARD_BASE_LEFT
|
MotionState
.
GUARD_BASE_RIGHT
done
=
MotionState
.
GUARD_BASE_LEFT
|
MotionState
.
GUARD_BASE_RIGHT
|
MotionState
.
HAND_MOVE_UP_LEFT
|
MotionState
.
HAND_MOVE_UP_RIGHT
;
break
;
case
"LG"
:
hand
=
Hand
.
Left
;
image
=
LoadNewSprite
(
"
LG
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/LG.png
"
);
prepare
=
MotionState
.
GUARD_BASE_LEFT
|
MotionState
.
HAND_MOVE_DOWN_LEFT
;
done
=
MotionState
.
GUARD_BASE_LEFT
done
=
MotionState
.
GUARD_BASE_LEFT
|
MotionState
.
HAND_MOVE_UP_LEFT
;
break
;
case
"RG"
:
hand
=
Hand
.
Right
;
image
=
LoadNewSprite
(
"
RG
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/RG.png
"
);
prepare
=
MotionState
.
GUARD_BASE_RIGHT
|
MotionState
.
HAND_MOVE_DOWN_RIGHT
;
done
=
MotionState
.
GUARD_BASE_RIGHT
...
...
Assets/MotionNotes/HandDown.cs
View file @
97d54097
...
...
@@ -24,17 +24,17 @@ public class HandDown : MotionNote
{
case
"BD"
:
hand
=
Hand
.
Both
;
image
=
LoadNewSprite
(
"
BD
"
);
done
=
MotionState
.
HAND_DOWN_LEFT
|
MotionState
.
HAND_DOWN_RIGHT
;
image
=
LoadNewSprite
(
"
Assets/MotionNotes/BD.png
"
);
done
=
MotionState
.
HAND_DOWN_LEFT
|
MotionState
.
HAND_DOWN_RIGHT
;
break
;
case
"LD"
:
hand
=
Hand
.
Left
;
image
=
LoadNewSprite
(
"
LD
"
);
done
=
MotionState
.
HAND_DOWN_LEFT
;
image
=
LoadNewSprite
(
"
Assets/MotionNotes/LD.png
"
);
done
=
MotionState
.
HAND_DOWN_LEFT
;
break
;
case
"RD"
:
hand
=
Hand
.
Right
;
image
=
LoadNewSprite
(
"
RD
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/RD.png
"
);
done
=
MotionState
.
HAND_DOWN_RIGHT
;
break
;
}
...
...
@@ -43,7 +43,7 @@ public class HandDown : MotionNote
{
}
public
override
void
Checkpoint
()
public
override
void
Checkpoint
()
{
IsChecked
=
true
;
}
...
...
Assets/MotionNotes/HandUp.cs
View file @
97d54097
...
...
@@ -24,17 +24,17 @@ public class HandUp : MotionNote
{
case
"BU"
:
hand
=
Hand
.
Both
;
image
=
LoadNewSprite
(
"
BU
"
);
done
=
MotionState
.
HAND_UP_LEFT
|
MotionState
.
HAND_UP_RIGHT
;
image
=
LoadNewSprite
(
"
Assets/MotionNotes/BU.png
"
);
done
=
MotionState
.
HAND_UP_LEFT
|
MotionState
.
HAND_UP_RIGHT
;
break
;
case
"LU"
:
hand
=
Hand
.
Left
;
image
=
LoadNewSprite
(
"
LU
"
);
done
=
MotionState
.
HAND_UP_LEFT
;
image
=
LoadNewSprite
(
"
Assets/MotionNotes/LU.png
"
);
done
=
MotionState
.
HAND_UP_LEFT
;
break
;
case
"RU"
:
hand
=
Hand
.
Right
;
image
=
LoadNewSprite
(
"
RU
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/RU.png
"
);
done
=
MotionState
.
HAND_UP_RIGHT
;
break
;
}
...
...
@@ -43,7 +43,7 @@ public class HandUp : MotionNote
{
}
public
override
void
Checkpoint
()
public
override
void
Checkpoint
()
{
IsChecked
=
true
;
}
...
...
Assets/MotionNotes/Headphone.cs
View file @
97d54097
...
...
@@ -24,17 +24,17 @@ public class Headphone : MotionNote
{
case
"BH"
:
hand
=
Hand
.
Both
;
image
=
LoadNewSprite
(
"
BH
"
);
done
=
MotionState
.
HEADPHONE_LEFT
|
MotionState
.
HEADPHONE_RIGHT
;
image
=
LoadNewSprite
(
"
Assets/MotionNotes/BH.png
"
);
done
=
MotionState
.
HEADPHONE_LEFT
|
MotionState
.
HEADPHONE_RIGHT
;
break
;
case
"LH"
:
hand
=
Hand
.
Left
;
image
=
LoadNewSprite
(
"
LH
"
);
done
=
MotionState
.
HEADPHONE_LEFT
;
image
=
LoadNewSprite
(
"
Assets/MotionNotes/LH.png
"
);
done
=
MotionState
.
HEADPHONE_LEFT
;
break
;
case
"RH"
:
hand
=
Hand
.
Right
;
image
=
LoadNewSprite
(
"
RH
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/RH.png
"
);
done
=
MotionState
.
HEADPHONE_RIGHT
;
break
;
}
...
...
Assets/MotionNotes/PushUp.cs
View file @
97d54097
...
...
@@ -24,22 +24,40 @@ public class PushUp : MotionNote
{
case
"BP"
:
hand
=
Hand
.
Both
;
image
=
LoadNewSprite
(
"
BP
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/BP.png
"
);
prepare
=
MotionState
.
HAND_MOVE_UP_LEFT
|
MotionState
.
HAND_MOVE_UP_RIGHT
;
done
=
MotionState
.
HAND_MOVE_DOWN_LEFT
|
MotionState
.
HAND_MOVE_DOWN_RIGHT
;
break
;
case
"LP"
:
hand
=
Hand
.
Left
;
image
=
LoadNewSprite
(
"
LP
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/LP.png
"
);
prepare
=
MotionState
.
HAND_MOVE_UP_LEFT
;
done
=
MotionState
.
HAND_MOVE_DOWN_LEFT
;
break
;
case
"RP"
:
hand
=
Hand
.
Right
;
image
=
LoadNewSprite
(
"
RP
"
);
image
=
LoadNewSprite
(
"
Assets/MotionNotes/RP.png
"
);
prepare
=
MotionState
.
HAND_MOVE_UP_RIGHT
;
done
=
MotionState
.
HAND_MOVE_DOWN_RIGHT
;
break
;
case
"BK"
:
hand
=
Hand
.
Both
;
image
=
LoadNewSprite
(
"Assets/MotionNotes/BK.png"
);
prepare
=
MotionState
.
HAND_MOVE_UP_LEFT
|
MotionState
.
HAND_MOVE_UP_RIGHT
|
MotionState
.
JUMP_PREPARE
;
done
=
MotionState
.
HAND_MOVE_DOWN_LEFT
|
MotionState
.
HAND_MOVE_DOWN_RIGHT
|
MotionState
.
JUMP_DONE
;
break
;
case
"LK"
:
hand
=
Hand
.
Left
;
image
=
LoadNewSprite
(
"Assets/MotionNotes/LK.png"
);
prepare
=
MotionState
.
HAND_MOVE_UP_LEFT
|
MotionState
.
JUMP_PREPARE
;
done
=
MotionState
.
HAND_MOVE_DOWN_LEFT
|
MotionState
.
JUMP_DONE
;
break
;
case
"RK"
:
hand
=
Hand
.
Right
;
image
=
LoadNewSprite
(
"Assets/MotionNotes/RK.png"
);
prepare
=
MotionState
.
HAND_MOVE_UP_RIGHT
|
MotionState
.
JUMP_PREPARE
;
done
=
MotionState
.
HAND_MOVE_DOWN_RIGHT
|
MotionState
.
JUMP_DONE
;
break
;
}
}
public
PushUp
(
float
start
,
float
end
=
0f
)
:
base
(
start
,
end
)
...
...
Assets/Script/InputManager.cs
View file @
97d54097
This diff is collapsed.
Click to expand it.
Assets/Script/Judge.cs
View file @
97d54097
...
...
@@ -12,7 +12,7 @@ public class Judge
new
Judge
(
"MISS"
)
{
Color
=
Color
.
red
,
IsBreak
=
true
}
};
internal
Judge
()
private
Judge
()
{
ButtonTimingRange
=
0f
;
Score
=
0
;
...
...
@@ -20,7 +20,7 @@ public class Judge
Color
=
Color
.
black
;
}
internal
Judge
(
string
name
)
:
this
()
{
Name
=
name
;
}
private
Judge
(
string
name
)
:
this
()
{
Name
=
name
;
}
public
string
Name
{
get
;
private
set
;
}
...
...
@@ -33,9 +33,9 @@ public class Judge
public
static
readonly
float
MaxButtonTimingRange
=
JudgeList
[
2
].
ButtonTimingRange
;
public
static
Judge
TestJudge
(
Note
note
,
float
elapsedTime
,
bool
end
=
false
,
bool
test
=
false
)
public
static
Judge
TestJudge
(
Note
note
,
float
elapsedTime
,
bool
isLong
=
false
,
bool
test
=
false
)
{
float
timing
=
end
?
note
.
EndTiming
:
note
.
StartTiming
;
float
timing
=
isLong
?
note
.
EndTiming
:
note
.
StartTiming
;
float
difference
=
elapsedTime
-
timing
;
if
(
test
)
...
...
@@ -45,10 +45,4 @@ public class Judge
return
result
.
Count
==
0
?
JudgeList
.
Last
()
:
result
[
0
];
}
public
static
bool
IsNonEmptyMiss
(
Note
note
,
float
elapsedTime
,
bool
end
=
false
)
{
float
timing
=
end
?
note
.
EndTiming
:
note
.
StartTiming
;
return
elapsedTime
-
timing
>
MaxButtonTimingRange
;
}
}
\ No newline at end of file
Assets/Script/JudgeManager.cs
View file @
97d54097
This diff is collapsed.
Click to expand it.
Assets/Script/MotionView.cs
View file @
97d54097
...
...
@@ -27,10 +27,7 @@ public class MotionView : MonoBehaviour
{
var
tracked
=
body
.
Where
(
x
=>
x
!=
null
&&
x
.
IsTracked
).
ToList
();
if
(
tracked
.
Count
()
==
0
||
tracked
[
0
].
Joints
==
null
)
{
discriminator
.
Initialize
();
return
MotionState
.
UNKNOWN
;
}
discriminator
.
Update
(
tracked
[
0
]);
...
...
@@ -67,8 +64,6 @@ internal class MotionDiscriminator
{
DistItvExtractor
extractor
;
bool
initialized
=
true
;
private
MotionState
_Motion
;
public
MotionState
Motion
...
...
@@ -84,19 +79,17 @@ internal class MotionDiscriminator
Initialize
();
}
p
ublic
void
Initialize
()
p
rivate
void
Initialize
()
{
_Motion
=
MotionState
.
UNKNOWN
;
initialized
=
true
;
}
public
void
Update
(
KinectModule
.
IBody
body
)
{
extractor
.
Extract
(
body
);
Initialize
();
Determine
();
initialized
=
false
;
}
float
Distance
(
CameraSpacePoint
a
,
CameraSpacePoint
b
)
...
...
@@ -110,6 +103,7 @@ internal class MotionDiscriminator
{
Clap
();
Jump
();
Hurray
();
HandMove
();
GuardBase
();
HandUp
();
...
...
@@ -135,21 +129,21 @@ internal class MotionDiscriminator
void
Jump
()
{
const
float
distPrepare
=
0.05f
,
distDone
=
0.0f
;
if
(
initialized
)
return
;
if
(
extractor
.
DistSpine
<
distPrepare
)
_Motion
|=
MotionState
.
JUMP_PREPARE
;
else
if
(
extractor
.
DistSpine
>
distDone
)
_Motion
|=
MotionState
.
JUMP_DONE
;
}
void
H
andMove
()
void
H
urray
()
{
if
(
initialized
||
extractor
.
DistHandBaseHead
<=
0.0f
)
return
;
if
(
extractor
.
DistHandBaseHead
>
0
)
_Motion
|=
MotionState
.
HURRAY
;
}
void
HandMove
()
{
if
(
extractor
.
DistHandLeft
>
0
)
_Motion
|=
MotionState
.
HAND_MOVE_UP_LEFT
;
else
if
(
extractor
.
DistHandLeft
<
0
)
...
...
Assets/Script/TrackManager.cs
View file @
97d54097
...
...
@@ -28,6 +28,21 @@ public class TrackManager : MonoBehaviour {
private
GameObject
selected
=
null
;
private
KeyDown
Pressed
{
get
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
DownArrow
))
return
KeyDown
.
Down
;
if
(
Input
.
GetKeyDown
(
KeyCode
.
UpArrow
))
return
KeyDown
.
Up
;
return
KeyDown
.
None
;
}
}
bool
IsPressedStart
{
get
{
return
InputManager
.
Instance
.
Status
==
ButtonStatus
.
Pressed
;
}
}
// Use this for initialization
void
Start
()
{
...
...
@@ -41,23 +56,32 @@ public class TrackManager : MonoBehaviour {
// Update is called once per frame
void
Update
()
{
if
(
trackList
.
transform
.
childCount
<
0
)
return
;
ScrollTrackList
();
if
(
Input
.
GetKeyDown
(
KeyCode
.
DownArrow
))
{
trackList
.
transform
.
GetChild
(
0
).
SetAsLastSibling
();
TrackBrowse
();
}
if
(
Input
.
GetKeyDown
(
KeyCode
.
UpArrow
))
{
trackList
.
transform
.
GetChild
(
trackList
.
transform
.
childCount
-
1
).
SetAsFirstSibling
();
TrackBrowse
();
}
if
(
InputManager
.
Instance
.
IsButtonPressed
)
if
(
IsPressedStart
)
StartTrack
();
}
void
ScrollTrackList
()
{
if
(
Pressed
==
KeyDown
.
Down
)
DownScroll
();
else
if
(
Pressed
==
KeyDown
.
Up
)
UpScroll
();
}
void
UpScroll
()
{
trackList
.
transform
.
GetChild
(
trackList
.
transform
.
childCount
-
1
).
SetAsFirstSibling
();
TrackBrowse
();
}
void
DownScroll
()
{
trackList
.
transform
.
GetChild
(
0
).
SetAsLastSibling
();
TrackBrowse
();
}
IEnumerable
<
TrackInfo
>
GenerateTrackInfos
()
{
return
new
DirectoryInfo
(
"Assets/Tracks"
)
...
...
@@ -117,4 +141,11 @@ public class TrackManager : MonoBehaviour {
GameManager
.
Instance
.
SceneTransition
(
"InGame"
);
}
private
enum
KeyDown
{
Up
,
Down
,
None
}
}
\ No newline at end of file
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