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
b6e8f197
Commit
b6e8f197
authored
Jan 22, 2018
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring JudgeManager
parent
97d54097
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
270 additions
and
139 deletions
+270
-139
InputManager.cs
Assets/Script/InputManager.cs
+93
-0
Judge.cs
Assets/Script/Judge.cs
+28
-6
JudgeManager.cs
Assets/Script/JudgeManager.cs
+148
-132
TrackManager.cs
Assets/Script/TrackManager.cs
+1
-1
No files found.
Assets/Script/InputManager.cs
View file @
b6e8f197
...
...
@@ -67,6 +67,54 @@ public class InputManager : MonoBehaviour {
}
}
public
InputStatus
ShortMotionStat
{
get
{
if
(
ClapStat
==
InputStatus
.
Entered
||
JumpStat
==
InputStatus
.
Entered
||
PushUpLeftStat
==
InputStatus
.
Entered
||
PushUpRightStat
==
InputStatus
.
Entered
||
PushUpBothStat
==
InputStatus
.
Entered
||
GuardLeftStat
==
InputStatus
.
Entered
||
GuardRightStat
==
InputStatus
.
Entered
||
GuardBothStat
==
InputStatus
.
Entered
)
return
InputStatus
.
Entered
;
return
InputStatus
.
None
;
}
}
public
InputStatus
LongMotionStat
{
get
{
if
(
HandUpLeftStat
==
InputStatus
.
Entered
||
HandUpLeftStat
==
InputStatus
.
Continuing
||
HandUpRightStat
==
InputStatus
.
Entered
||
HandUpRightStat
==
InputStatus
.
Continuing
||
HandUpBothStat
==
InputStatus
.
Entered
||
HandUpBothStat
==
InputStatus
.
Continuing
||
HandDownLeftStat
==
InputStatus
.
Entered
||
HandDownLeftStat
==
InputStatus
.
Continuing
||
HandDownRightStat
==
InputStatus
.
Entered
||
HandDownRightStat
==
InputStatus
.
Continuing
||
HandDownBothStat
==
InputStatus
.
Entered
||
HandDownBothStat
==
InputStatus
.
Continuing
||
JesusStat
==
InputStatus
.
Entered
||
JesusStat
==
InputStatus
.
Continuing
||
HeadphoneLeftStat
==
InputStatus
.
Entered
||
HeadphoneLeftStat
==
InputStatus
.
Continuing
||
HeadphoneRightStat
==
InputStatus
.
Entered
||
HeadphoneRightStat
==
InputStatus
.
Continuing
||
HeadphoneBothStat
==
InputStatus
.
Entered
||
HeadphoneBothStat
==
InputStatus
.
Continuing
||
OnTheTableStat
==
InputStatus
.
Entered
||
OnTheTableStat
==
InputStatus
.
Continuing
)
return
InputStatus
.
Entered
;
return
InputStatus
.
None
;
}
}
public
InputStatus
ClapStat
{
get
{
return
ShortMotionToInput
(
"Clap"
);
}
}
public
InputStatus
JumpStat
...
...
@@ -75,25 +123,70 @@ public class InputManager : MonoBehaviour {
{
get
{
return
ShortMotionToInput
(
"PushUpLeft"
);
}
}
public
InputStatus
PushUpRightStat
{
get
{
return
ShortMotionToInput
(
"PushUpRight"
);
}
}
public
InputStatus
PushUpBothStat
{
get
{
var
left
=
PushUpLeftStat
;
var
right
=
PushUpRightStat
;
return
left
==
right
?
left
:
InputStatus
.
None
;
}
}
public
InputStatus
GuardLeftStat
{
get
{
return
ShortMotionToInput
(
"GuardLeft"
);
}
}
public
InputStatus
GuardRightStat
{
get
{
return
ShortMotionToInput
(
"GuardRight"
);
}
}
public
InputStatus
GuardBothStat
{
get
{
var
left
=
GuardLeftStat
;
var
right
=
GuardRightStat
;
return
left
==
right
?
left
:
InputStatus
.
None
;
}
}
public
InputStatus
HandUpLeftStat
{
get
{
return
LongMotionToInput
(
"HandUpLeft"
);
}
}
public
InputStatus
HandUpRightStat
{
get
{
return
LongMotionToInput
(
"HandUpRight"
);
}
}
public
InputStatus
HandUpBothStat
{
get
{
var
left
=
HandUpLeftStat
;
var
right
=
HandUpRightStat
;
return
left
==
right
?
left
:
InputStatus
.
None
;
}
}
public
InputStatus
HandDownLeftStat
{
get
{
return
LongMotionToInput
(
"HandDownLeft"
);
}
}
public
InputStatus
HandDownRightStat
{
get
{
return
LongMotionToInput
(
"HandDownRight"
);
}
}
public
InputStatus
HandDownBothStat
{
get
{
var
left
=
HandDownLeftStat
;
var
right
=
HandDownRightStat
;
return
left
==
right
?
left
:
InputStatus
.
None
;
}
}
public
InputStatus
JesusStat
{
get
{
return
LongMotionToInput
(
"Jesus"
);
}
}
public
InputStatus
HeadphoneLeftStat
{
get
{
return
LongMotionToInput
(
"HeadphoneLeft"
);
}
}
public
InputStatus
HeadphoneRightStat
{
get
{
return
LongMotionToInput
(
"HeadphoneRight"
);
}
}
public
InputStatus
HeadphoneBothStat
{
get
{
var
left
=
HeadphoneLeftStat
;
var
right
=
HeadphoneRightStat
;
return
left
==
right
?
left
:
InputStatus
.
None
;
}
}
public
InputStatus
OnTheTableStat
{
get
{
return
LongMotionToInput
(
"OnTheTable"
);
}
}
...
...
Assets/Script/Judge.cs
View file @
b6e8f197
...
...
@@ -6,9 +6,9 @@ public class Judge
{
public
static
readonly
List
<
Judge
>
JudgeList
=
new
List
<
Judge
>
{
new
Judge
(
"PERFECT"
)
{
ButtonTimingRange
=
80f
,
Score
=
2
,
Color
=
Color
.
cyan
},
new
Judge
(
"GOOD"
)
{
ButtonTimingRange
=
100f
,
Score
=
1
,
Color
=
Color
.
yellow
},
new
Judge
(
"BAD"
)
{
ButtonTimingRange
=
120f
,
Color
=
Color
.
blue
,
IsBreak
=
true
},
new
Judge
(
"PERFECT"
)
{
ButtonTimingRange
=
PerfectTime
,
Score
=
2
,
Color
=
Color
.
cyan
},
new
Judge
(
"GOOD"
)
{
ButtonTimingRange
=
GoodTime
,
Score
=
1
,
Color
=
Color
.
yellow
},
new
Judge
(
"BAD"
)
{
ButtonTimingRange
=
BadTime
,
Color
=
Color
.
blue
,
IsBreak
=
true
},
new
Judge
(
"MISS"
)
{
Color
=
Color
.
red
,
IsBreak
=
true
}
};
...
...
@@ -24,18 +24,23 @@ public class Judge
public
string
Name
{
get
;
private
set
;
}
private
const
float
PerfectTime
=
80f
,
GoodTime
=
100f
,
BadTime
=
120f
;
public
float
ButtonTimingRange
{
get
;
private
set
;
}
public
int
Score
{
get
;
private
set
;
}
public
bool
IsBreak
{
get
;
private
set
;
}
public
Color
Color
{
get
;
private
set
;
}
public
static
readonly
Judge
BAD
=
JudgeList
[
2
];
public
static
readonly
Judge
MISS
=
JudgeList
.
Last
();
public
static
readonly
float
MaxButtonTimingRange
=
JudgeList
[
2
].
ButtonTimingRang
e
;
float
MaxButtonTimingRange
=
BadTim
e
;
public
static
Judge
TestJudge
(
Note
note
,
float
elapsedTime
,
bool
isLong
=
false
,
bool
test
=
false
)
public
static
Judge
TestJudge
(
Note
note
,
float
elapsedTime
,
bool
end
=
false
,
bool
test
=
false
)
{
float
timing
=
isLong
?
note
.
EndTiming
:
note
.
StartTiming
;
float
timing
=
end
?
note
.
EndTiming
:
note
.
StartTiming
;
float
difference
=
elapsedTime
-
timing
;
if
(
test
)
...
...
@@ -45,4 +50,21 @@ public class Judge
return
result
.
Count
==
0
?
JudgeList
.
Last
()
:
result
[
0
];
}
public
static
bool
IsPastNote
(
Note
note
,
float
elapsedTime
)
{
float
timing
=
note
.
IsLong
&&
note
.
Activated
?
note
.
EndTiming
:
note
.
StartTiming
;
return
elapsedTime
-
timing
>
BadTime
;
}
public
static
bool
IsNoteEnd
(
Note
note
,
float
elapsedTime
)
{
return
elapsedTime
-
note
.
EndTiming
<=
BadTime
;
}
public
static
bool
IsNoteComboBroken
(
Judge
judge
)
{
return
judge
==
BAD
||
judge
==
MISS
;
}
}
\ No newline at end of file
Assets/Script/JudgeManager.cs
View file @
b6e8f197
This diff is collapsed.
Click to expand it.
Assets/Script/TrackManager.cs
View file @
b6e8f197
...
...
@@ -41,7 +41,7 @@ public class TrackManager : MonoBehaviour {
}
bool
IsPressedStart
{
get
{
return
InputManager
.
Instance
.
Status
==
ButtonStatus
.
Pressed
;
}
}
{
get
{
return
InputManager
.
Instance
.
ButtonStat
==
ButtonStatus
.
Pressed
;
}
}
// Use this for initialization
void
Start
()
...
...
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