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
ed3a1d8e
Commit
ed3a1d8e
authored
Jan 25, 2018
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix malfunctions
parent
2e76df20
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1173 additions
and
323 deletions
+1173
-323
GreenScreen.mat
Assets/Resources/GreenScreen/GreenScreen.mat
+1
-1
InGame.unity
Assets/Scene/InGame.unity
+490
-136
SetSelect.unity
Assets/Scene/SetSelect.unity
+11
-31
tmp.unity
Assets/Scene/tmp.unity
+430
-0
tmp.unity.meta
Assets/Scene/tmp.unity.meta
+9
-0
CoordinateMapperManager.cs
Assets/Script/CoordinateMapperManager.cs
+8
-8
CoordinateMapperView.cs
Assets/Script/CoordinateMapperView.cs
+6
-3
GameManager.cs
Assets/Script/GameManager.cs
+1
-1
InputManager.cs
Assets/Script/InputManager.cs
+17
-37
JudgeManager.cs
Assets/Script/JudgeManager.cs
+66
-48
MotionView.cs
Assets/Script/MotionView.cs
+22
-4
CoordinateMapperManagerTests.cs
Assets/Script/Tests/CoordinateMapperManagerTests.cs
+0
-27
CoordinateMapperViewTests.cs
Assets/Script/Tests/CoordinateMapperViewTests.cs
+1
-1
InputManagerTests.cs
Assets/Script/Tests/InputManagerTests.cs
+33
-0
InputManagerTests.cs.meta
Assets/Script/Tests/InputManagerTests.cs.meta
+13
-0
TrackInfo.cs
Assets/Script/TrackInfo.cs
+21
-23
TrackManager.cs
Assets/Script/TrackManager.cs
+2
-3
Bigroom1.bpe
Assets/Tracks/Test/Bigroom1.bpe
+2
-0
JJR.bpe
Assets/Tracks/Test/JJR.bpe
+2
-0
tmp.bpe
Assets/Tracks/Tutorial/tmp.bpe
+26
-0
tmp.bpe.meta
Assets/Tracks/Tutorial/tmp.bpe.meta
+9
-0
EditorBuildSettings.asset
ProjectSettings/EditorBuildSettings.asset
+3
-0
No files found.
Assets/Resources/GreenScreen/GreenScreen.mat
View file @
ed3a1d8e
...
@@ -37,4 +37,4 @@ Material:
...
@@ -37,4 +37,4 @@ Material:
m_Floats
:
m_Floats
:
-
_Cutoff
:
0
-
_Cutoff
:
0
m_Colors
:
m_Colors
:
-
_Color
:
{
r
:
0
,
g
:
1
,
b
:
0
,
a
:
0
}
-
_Color
:
{
r
:
0
,
g
:
1
,
b
:
0
,
a
:
1
}
Assets/Scene/InGame.unity
View file @
ed3a1d8e
This diff is collapsed.
Click to expand it.
Assets/Scene/SetSelect.unity
View file @
ed3a1d8e
...
@@ -77,15 +77,18 @@ LightmapSettings:
...
@@ -77,15 +77,18 @@ LightmapSettings:
m_PVRDirectSampleCount
:
32
m_PVRDirectSampleCount
:
32
m_PVRSampleCount
:
500
m_PVRSampleCount
:
500
m_PVRBounces
:
2
m_PVRBounces
:
2
m_PVRFiltering
:
0
m_PVRFilterTypeDirect
:
0
m_PVRFilterTypeIndirect
:
0
m_PVRFilterTypeAO
:
0
m_PVRFilteringMode
:
1
m_PVRFilteringMode
:
1
m_PVRCulling
:
1
m_PVRCulling
:
1
m_PVRFilteringGaussRadiusDirect
:
1
m_PVRFilteringGaussRadiusDirect
:
1
m_PVRFilteringGaussRadiusIndirect
:
5
m_PVRFilteringGaussRadiusIndirect
:
5
m_PVRFilteringGaussRadiusAO
:
2
m_PVRFilteringGaussRadiusAO
:
2
m_PVRFilteringAtrousColorSigma
:
1
m_PVRFilteringAtrousPositionSigmaDirect
:
0.5
m_PVRFilteringAtrousNormalSigma
:
1
m_PVRFilteringAtrousPositionSigmaIndirect
:
2
m_PVRFilteringAtrousPositionSigma
:
1
m_PVRFilteringAtrousPositionSigmaAO
:
1
m_ShowResolutionOverlay
:
1
m_LightingDataAsset
:
{
fileID
:
0
}
m_LightingDataAsset
:
{
fileID
:
0
}
m_UseShadowmask
:
1
m_UseShadowmask
:
1
---
!u!196
&4
---
!u!196
&4
...
@@ -107,6 +110,8 @@ NavMeshSettings:
...
@@ -107,6 +110,8 @@ NavMeshSettings:
manualTileSize
:
0
manualTileSize
:
0
tileSize
:
256
tileSize
:
256
accuratePlacement
:
0
accuratePlacement
:
0
debug
:
m_Flags
:
0
m_NavMeshData
:
{
fileID
:
0
}
m_NavMeshData
:
{
fileID
:
0
}
---
!u!1
&135533173
---
!u!1
&135533173
GameObject
:
GameObject
:
...
@@ -484,7 +489,6 @@ GameObject:
...
@@ -484,7 +489,6 @@ GameObject:
m_Component
:
m_Component
:
-
component
:
{
fileID
:
609057691
}
-
component
:
{
fileID
:
609057691
}
-
component
:
{
fileID
:
609057690
}
-
component
:
{
fileID
:
609057690
}
-
component
:
{
fileID
:
609057692
}
-
component
:
{
fileID
:
609057689
}
-
component
:
{
fileID
:
609057689
}
m_Layer
:
0
m_Layer
:
0
m_Name
:
Managers
m_Name
:
Managers
...
@@ -526,6 +530,7 @@ MonoBehaviour:
...
@@ -526,6 +530,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
a9d22e7eb4921ca47b18c68e43c0eb6e
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
a9d22e7eb4921ca47b18c68e43c0eb6e
,
type
:
3
}
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
defaultSound
:
{
fileID
:
0
}
---
!u!4
&609057691
---
!u!4
&609057691
Transform
:
Transform
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -539,17 +544,6 @@ Transform:
...
@@ -539,17 +544,6 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&609057692
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
609057688
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
6e697643158480b4ba850d906eac1bc2
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!1
&634338382
---
!u!1
&634338382
GameObject
:
GameObject
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -598,20 +592,6 @@ Light:
...
@@ -598,20 +592,6 @@ Light:
m_Lightmapping
:
4
m_Lightmapping
:
4
m_AreaSize
:
{
x
:
1
,
y
:
1
}
m_AreaSize
:
{
x
:
1
,
y
:
1
}
m_BounceIntensity
:
1
m_BounceIntensity
:
1
m_FalloffTable
:
m_Table[0]
:
0
m_Table[1]
:
0
m_Table[2]
:
0
m_Table[3]
:
0
m_Table[4]
:
0
m_Table[5]
:
0
m_Table[6]
:
0
m_Table[7]
:
0
m_Table[8]
:
0
m_Table[9]
:
0
m_Table[10]
:
0
m_Table[11]
:
0
m_Table[12]
:
0
m_ColorTemperature
:
6570
m_ColorTemperature
:
6570
m_UseColorTemperature
:
0
m_UseColorTemperature
:
0
m_ShadowRadius
:
0
m_ShadowRadius
:
0
...
@@ -830,11 +810,11 @@ Camera:
...
@@ -830,11 +810,11 @@ Camera:
m_TargetEye
:
3
m_TargetEye
:
3
m_HDR
:
1
m_HDR
:
1
m_AllowMSAA
:
1
m_AllowMSAA
:
1
m_AllowDynamicResolution
:
0
m_ForceIntoRT
:
0
m_ForceIntoRT
:
0
m_OcclusionCulling
:
1
m_OcclusionCulling
:
1
m_StereoConvergence
:
10
m_StereoConvergence
:
10
m_StereoSeparation
:
0.022
m_StereoSeparation
:
0.022
m_StereoMirrorMode
:
0
---
!u!4
&1050043563
---
!u!4
&1050043563
Transform
:
Transform
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
...
Assets/Scene/tmp.unity
0 → 100644
View file @
ed3a1d8e
This diff is collapsed.
Click to expand it.
Assets/Scene/tmp.unity.meta
0 → 100644
View file @
ed3a1d8e
fileFormatVersion: 2
guid: bd1125abc59508941a9858dc3f08c1b7
timeCreated: 1516864014
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Script/CoordinateMapperManager.cs
View file @
ed3a1d8e
...
@@ -131,14 +131,14 @@ namespace KinectModule
...
@@ -131,14 +131,14 @@ namespace KinectModule
public
class
SourceBuffer
public
class
SourceBuffer
{
{
private
byte
[]
_ColorBuffer
=
new
byte
[
KinectConstants
.
ColorWidth
*
private
byte
[]
_ColorBuffer
=
new
byte
[
KinectConstants
.
ColorWidth
*
KinectConstants
.
ColorHeight
*
KinectConstants
.
ColorHeight
*
KinectConstants
.
ColorCount
],
KinectConstants
.
ColorCount
],
_BodyIndexBuffer
=
new
byte
[
KinectConstants
.
DepthWidth
*
_BodyIndexBuffer
=
new
byte
[
KinectConstants
.
DepthWidth
*
KinectConstants
.
DepthHeight
];
KinectConstants
.
DepthHeight
];
private
ushort
[]
_DepthBuffer
=
new
ushort
[
KinectConstants
.
DepthWidth
*
private
ushort
[]
_DepthBuffer
=
new
ushort
[
KinectConstants
.
DepthWidth
*
KinectConstants
.
DepthHeight
];
KinectConstants
.
DepthHeight
];
private
IBody
[]
_BodyBuffer
=
new
IBody
[
KinectConstants
.
BodyCount
];
private
IBody
[]
_BodyBuffer
=
new
IBody
[
KinectConstants
.
BodyCount
];
public
byte
[]
ColorBuffer
public
byte
[]
ColorBuffer
{
get
{
return
_ColorBuffer
;
}
}
{
get
{
return
_ColorBuffer
;
}
}
...
...
Assets/Script/CoordinateMapperView.cs
View file @
ed3a1d8e
...
@@ -4,6 +4,8 @@ using Windows.Kinect;
...
@@ -4,6 +4,8 @@ using Windows.Kinect;
public
class
CoordinateMapperView
:
MonoBehaviour
public
class
CoordinateMapperView
:
MonoBehaviour
{
{
private
GameObject
manager
;
private
ComputeBuffer
DepthBuffer
,
private
ComputeBuffer
DepthBuffer
,
BodyIndexBuffer
;
BodyIndexBuffer
;
...
@@ -12,13 +14,12 @@ public class CoordinateMapperView : MonoBehaviour
...
@@ -12,13 +14,12 @@ public class CoordinateMapperView : MonoBehaviour
void
Start
()
void
Start
()
{
{
var
CoordinateMapperManager
=
GameObject
.
Find
(
"Managers"
).
GetComponent
<
CoordinateMapperManager
>();
var
CoordinateMapperManager
=
GameObject
.
Find
(
"InGameManagers"
).
GetComponent
<
CoordinateMapperManager
>();
CoordinateMapperManager
.
enabled
=
true
;
var
material
=
GetComponent
<
Renderer
>().
material
;
var
material
=
GetComponent
<
Renderer
>().
material
;
material
.
SetTexture
(
"_MainTex"
,
CoordinateMapperManager
.
ColorTexture
);
material
.
SetTexture
(
"_MainTex"
,
CoordinateMapperManager
.
ColorTexture
);
DepthBuffer
=
GenerateBuffer
(
"depthCoordinates"
,
sizeof
(
float
)
*
2
,
DepthBuffer
=
GenerateBuffer
(
"depthCoordinates"
,
sizeof
(
float
)
*
2
,
(
DepthPoints
=
CoordinateMapperManager
.
DepthCoordinates
),
material
);
(
DepthPoints
=
CoordinateMapperManager
.
DepthCoordinates
),
material
);
BodyIndexBuffer
=
GenerateBuffer
(
"BodyIndexBuffer"
,
sizeof
(
float
),
BodyIndexBuffer
=
GenerateBuffer
(
"BodyIndexBuffer"
,
sizeof
(
float
),
...
@@ -34,6 +35,8 @@ public class CoordinateMapperView : MonoBehaviour
...
@@ -34,6 +35,8 @@ public class CoordinateMapperView : MonoBehaviour
void
Update
()
void
Update
()
{
{
//TODO: fix perf on this call.
//TODO: fix perf on this call.
DepthBuffer
.
SetData
(
DepthPoints
);
DepthBuffer
.
SetData
(
DepthPoints
);
...
...
Assets/Script/GameManager.cs
View file @
ed3a1d8e
...
@@ -25,7 +25,7 @@ public class GameManager : MonoBehaviour {
...
@@ -25,7 +25,7 @@ public class GameManager : MonoBehaviour {
}
}
[
SerializeField
]
[
SerializeField
]
public
AudioSource
defaultSound
;
public
string
defaultSound
;
public
TrackInfo
CurrentTrack
{
get
;
set
;
}
public
TrackInfo
CurrentTrack
{
get
;
set
;
}
...
...
Assets/Script/InputManager.cs
View file @
ed3a1d8e
using
System
;
using
System
;
using
UnityEngine
;
using
UnityEngine
;
public
class
InputManager
:
MonoBehaviour
{
public
class
InputManager
:
MonoBehaviour
private
static
InputManager
instance
;
{
public
static
InputManager
Instance
{
get
{
if
(
instance
==
null
)
{
instance
=
FindObjectOfType
(
typeof
(
InputManager
))
as
InputManager
;
}
return
instance
;
}
}
private
bool
IsButtonDownPrev
{
get
;
set
;
}
private
bool
IsButtonDownPrev
{
get
;
set
;
}
private
bool
IsButtonDown
private
bool
IsButtonDown
{
{
get
{
return
Input
.
GetKey
(
KeyCode
.
Space
)
||
Input
.
GetKey
(
KeyCode
.
Joystick1Button0
);
}
}
get
{
return
Input
.
GetKey
(
KeyCode
.
Space
)
||
Input
.
GetKey
(
KeyCode
.
Joystick1Button0
);
}
}
private
MotionState
PrevMotionState
{
get
;
set
;
}
private
MotionState
PrevMotionState
{
get
;
set
;
}
public
MotionState
CurrentMotionState
{
get
;
set
;
}
public
MotionState
CurrentMotionState
{
get
;
set
;
}
public
ButtonStatus
ButtonStat
{
get
{
if
(!
IsButtonDown
)
return
ButtonStatus
.
Released
;
if
(
IsButtonDownPrev
)
return
ButtonStatus
.
Holding
;
return
ButtonStatus
.
Pressed
;
}
}
public
InputStatus
ShortButtonStat
public
InputStatus
ShortButtonStat
{
{
get
get
...
@@ -118,8 +89,7 @@ public class InputManager : MonoBehaviour {
...
@@ -118,8 +89,7 @@ public class InputManager : MonoBehaviour {
}
}
}
}
// Update is called once per frame
private
void
Update
()
void
Update
()
{
{
IsButtonDownPrev
=
IsButtonDown
;
IsButtonDownPrev
=
IsButtonDown
;
PrevMotionState
=
CurrentMotionState
;
PrevMotionState
=
CurrentMotionState
;
...
@@ -129,7 +99,7 @@ public class InputManager : MonoBehaviour {
...
@@ -129,7 +99,7 @@ public class InputManager : MonoBehaviour {
{
{
if
(
name
.
Contains
(
"Both"
))
if
(
name
.
Contains
(
"Both"
))
{
{
var
tmpname
=
name
.
Substring
(
name
.
IndexOf
(
"Both"
));
var
tmpname
=
name
.
Substring
(
0
,
name
.
IndexOf
(
"Both"
));
var
left
=
LongMotionToInput
(
tmpname
+
"Left"
);
var
left
=
LongMotionToInput
(
tmpname
+
"Left"
);
var
right
=
LongMotionToInput
(
tmpname
+
"Right"
);
var
right
=
LongMotionToInput
(
tmpname
+
"Right"
);
...
@@ -161,7 +131,7 @@ public class InputManager : MonoBehaviour {
...
@@ -161,7 +131,7 @@ public class InputManager : MonoBehaviour {
{
{
if
(
name
.
Contains
(
"Both"
))
if
(
name
.
Contains
(
"Both"
))
{
{
var
tmpname
=
name
.
Substring
(
name
.
IndexOf
(
"Both"
));
var
tmpname
=
name
.
Substring
(
0
,
name
.
IndexOf
(
"Both"
));
var
left
=
ShortMotionToInput
(
tmpname
+
"Left"
);
var
left
=
ShortMotionToInput
(
tmpname
+
"Left"
);
var
right
=
ShortMotionToInput
(
tmpname
+
"Right"
);
var
right
=
ShortMotionToInput
(
tmpname
+
"Right"
);
...
@@ -402,4 +372,14 @@ public enum InputStatus
...
@@ -402,4 +372,14 @@ public enum InputStatus
Continuing
,
Continuing
,
Stopped
,
Stopped
,
None
None
}
}
\ No newline at end of file
internal
interface
IButtonDownGetter
{
bool
IsButtonDown
{
get
;
}
}
internal
class
ButtonDownGetter
{
}
Assets/Script/JudgeManager.cs
View file @
ed3a1d8e
...
@@ -7,29 +7,16 @@ using UnityEngine.UI;
...
@@ -7,29 +7,16 @@ using UnityEngine.UI;
public
class
JudgeManager
:
MonoBehaviour
public
class
JudgeManager
:
MonoBehaviour
{
{
private
static
JudgeManager
instance
;
public
static
JudgeManager
Instance
{
get
{
if
(
instance
==
null
)
{
instance
=
FindObjectOfType
(
typeof
(
JudgeManager
))
as
JudgeManager
;
}
return
instance
;
}
}
float
latency
=
225f
;
float
latency
=
225f
;
float
scrollMultiplier
=
1.0f
;
float
scrollMultiplier
=
1.0f
;
float
startOffset
=
-
5f
;
float
startOffset
=
-
5f
;
float
baseTime
;
bool
IsInitTime
;
bool
IsGameEnd
;
bool
IsGameEnd
;
private
GameObject
offset
;
private
GameObject
offset
;
private
GameObject
noteobj
,
smobj
,
lmobj
;
private
GameObject
noteobj
;
private
MotionGageManager
motionGageManager
;
private
MotionGageManager
motionGageManager
;
private
GameObject
judgeText
;
private
GameObject
judgeText
;
...
@@ -53,13 +40,16 @@ public class JudgeManager : MonoBehaviour
...
@@ -53,13 +40,16 @@ public class JudgeManager : MonoBehaviour
}
}
}
}
private
InputManager
input
;
private
NoteCondition
condition
;
void
SetObjectRef
()
void
SetObjectRef
()
{
{
offset
=
GameObject
.
Find
(
"Offset"
);
offset
=
GameObject
.
Find
(
"Offset"
);
noteobj
=
GameObject
.
Find
(
"Noteobj"
);
noteobj
=
GameObject
.
Find
(
"Noteobj"
);
smobj
=
GameObject
.
Find
(
"SMobj"
);
lmobj
=
GameObject
.
Find
(
"LMobj"
);
judgeText
=
GameObject
.
Find
(
"Judge"
);
judgeText
=
GameObject
.
Find
(
"Judge"
);
input
=
GameObject
.
Find
(
"InGameManagers"
).
GetComponent
<
InputManager
>();
condition
=
new
NoteCondition
(
input
);
motionGageManager
=
new
MotionGageManager
motionGageManager
=
new
MotionGageManager
{
motionGuage
=
GameObject
.
Find
(
"Motion Guage"
)
};
{
motionGuage
=
GameObject
.
Find
(
"Motion Guage"
)
};
}
}
...
@@ -70,13 +60,23 @@ public class JudgeManager : MonoBehaviour
...
@@ -70,13 +60,23 @@ public class JudgeManager : MonoBehaviour
judgeText
.
SetActive
(
false
);
judgeText
.
SetActive
(
false
);
motionGageManager
.
ResetGuage
();
motionGageManager
.
ResetGuage
();
IsGameEnd
=
false
;
IsGameEnd
=
false
;
baseTime
=
0f
;
IsInitTime
=
false
;
}
}
void
LoadGameObjects
()
void
LoadGameObjects
()
{
{
motionSampleDisplayPrefab
=
Resources
.
Load
(
"Motion Sample Display"
)
as
GameObject
;
motionSampleDisplayPrefab
=
Resources
.
Load
(
"Motion Sample Display"
)
as
GameObject
;
GameManager
.
Instance
.
CurrentTrack
.
Notes
.
ForEach
(
LoadNote
);
GameManager
.
Instance
.
CurrentTrack
.
Notes
.
ForEach
(
LoadNote
);
Instantiate
(
GameManager
.
Instance
.
defaultSound
);
//if (GameManager.Instance.defaultSound != null)
// Instantiate(GameManager.Instance.defaultSound);
var
sounds
=
GameObject
.
Find
(
"Sounds"
);
sounds
.
transform
.
Cast
<
Transform
>()
.
ToList
()
.
ForEach
(
x
=>
x
.
gameObject
.
SetActive
(
false
));
if
(
GameManager
.
Instance
.
CurrentTrack
.
BGM
!=
null
)
sounds
.
transform
.
Find
(
GameManager
.
Instance
.
CurrentTrack
.
BGM
)
.
gameObject
.
SetActive
(
true
);
}
}
// Use this for initialization
// Use this for initialization
...
@@ -90,9 +90,16 @@ public class JudgeManager : MonoBehaviour
...
@@ -90,9 +90,16 @@ public class JudgeManager : MonoBehaviour
// Update is called once per frame
// Update is called once per frame
void
Update
()
void
Update
()
{
{
float
timing
=
motionGageManager
.
UpdateTime
();
;
float
current
=
motionGageManager
.
UpdateTime
();
if
(!
IsInitTime
)
{
baseTime
=
current
;
IsInitTime
=
true
;
}
float
timing
=
current
-
baseTime
;
offset
.
transform
.
position
=
Vector3
.
left
*
timing
*
ScrollSpeed
;
offset
.
transform
.
position
=
Vector3
.
left
*
current
*
ScrollSpeed
;
motionGageManager
.
UpdateGuage
();
motionGageManager
.
UpdateGuage
();
...
@@ -132,23 +139,23 @@ public class JudgeManager : MonoBehaviour
...
@@ -132,23 +139,23 @@ public class JudgeManager : MonoBehaviour
void
JudgeShortNote
(
Note
note
,
float
timing
)
void
JudgeShortNote
(
Note
note
,
float
timing
)
{
{
if
(
NoteC
ondition
.
IsWrongInput
(
note
))
if
(
c
ondition
.
IsWrongInput
(
note
))
WrongNoteProc
(
note
);
WrongNoteProc
(
note
);
else
if
(
NoteC
ondition
.
IsShortNoteEntered
(
note
))
else
if
(
c
ondition
.
IsShortNoteEntered
(
note
))
EnteredNoteProc
(
note
,
timing
);
EnteredNoteProc
(
note
,
timing
);
}
}
void
JudgeLongNote
(
Note
note
,
float
timing
)
void
JudgeLongNote
(
Note
note
,
float
timing
)
{
{
if
(
NoteC
ondition
.
IsWrongInput
(
note
))
if
(
c
ondition
.
IsWrongInput
(
note
))
WrongNoteProc
(
note
);
WrongNoteProc
(
note
);
else
if
(
NoteC
ondition
.
IsLongNoteStartCorrectly
(
note
))
else
if
(
c
ondition
.
IsLongNoteStartCorrectly
(
note
))
EnteredNoteProc
(
note
,
timing
);
EnteredNoteProc
(
note
,
timing
);
else
if
(
NoteC
ondition
.
IsLongNoteHoldCorrectly
(
note
))
else
if
(
c
ondition
.
IsLongNoteHoldCorrectly
(
note
))
ContinuingNoteProc
(
note
,
timing
);
ContinuingNoteProc
(
note
,
timing
);
else
if
(
NoteC
ondition
.
IsLongNoteFinishCorrectly
(
note
,
timing
))
else
if
(
c
ondition
.
IsLongNoteFinishCorrectly
(
note
,
timing
))
CorrectlyStoppedNoteProc
(
note
,
timing
);
CorrectlyStoppedNoteProc
(
note
,
timing
);
else
if
(
NoteC
ondition
.
IsLongNoteFinishIncorrectly
(
note
,
timing
))
else
if
(
c
ondition
.
IsLongNoteFinishIncorrectly
(
note
,
timing
))
IncorrectlyStoppedNoteProc
(
note
,
timing
);
IncorrectlyStoppedNoteProc
(
note
,
timing
);
}
}
...
@@ -179,7 +186,7 @@ public class JudgeManager : MonoBehaviour
...
@@ -179,7 +186,7 @@ public class JudgeManager : MonoBehaviour
SetJudge
(
judge
);
SetJudge
(
judge
);
if
(
isNoteEnd
||
if
(
isNoteEnd
||
NoteC
ondition
.
IsNoteBroken
(
note
,
timing
,
judge
))
c
ondition
.
IsNoteBroken
(
note
,
timing
,
judge
))
DeactivateNote
(
note
);
DeactivateNote
(
note
);
}
}
...
@@ -259,55 +266,66 @@ public class JudgeManager : MonoBehaviour
...
@@ -259,55 +266,66 @@ public class JudgeManager : MonoBehaviour
{
{
if
(!
onResult
)
if
(!
onResult
)
{
{
GameManager
.
Instance
.
SceneTransition
(
"Result"
,
true
);
Destroy
(
GetComponent
<
InputManager
>());
Destroy
(
GetComponent
<
MotionView
>());
Destroy
(
GetComponent
<
CoordinateMapperManager
>());
Destroy
(
this
);
GameManager
.
Instance
.
SceneTransition
(
"Result"
);
onResult
=
true
;
onResult
=
true
;
}
}
}
}
private
class
NoteCondition
private
class
NoteCondition
{
{
public
static
Dictionary
<
string
,
InputStatus
>
WrongInput
(
Note
note
)
private
InputManager
manager
;
public
NoteCondition
(
InputManager
inputManager
)
{
manager
=
inputManager
;
}
public
Dictionary
<
string
,
InputStatus
>
WrongInput
(
Note
note
)
{
{
if
(
note
is
MotionNote
)
if
(
note
is
MotionNote
)
return
new
Dictionary
<
string
,
InputStatus
>
return
new
Dictionary
<
string
,
InputStatus
>
{
{
{
"short"
,
InputManager
.
Instance
.
ShortMoti
onStat
},
{
"short"
,
manager
.
ShortButt
onStat
},
{
"long"
,
InputManager
.
Instance
.
LongMoti
onStat
}
{
"long"
,
manager
.
LongButt
onStat
}
};
};
return
new
Dictionary
<
string
,
InputStatus
>
return
new
Dictionary
<
string
,
InputStatus
>
{
{
{
"short"
,
InputManager
.
Instance
.
ShortButt
onStat
},
{
"short"
,
manager
.
ShortMoti
onStat
},
{
"long"
,
InputManager
.
Instance
.
LongButt
onStat
}
{
"long"
,
manager
.
LongMoti
onStat
}
};
};
}
}
public
static
Dictionary
<
string
,
InputStatus
>
JudgeInput
(
Note
note
)
public
Dictionary
<
string
,
InputStatus
>
JudgeInput
(
Note
note
)
{
{
if
(
note
is
MotionNote
)
if
(
note
is
MotionNote
)
return
new
Dictionary
<
string
,
InputStatus
>
return
new
Dictionary
<
string
,
InputStatus
>
{
{
{
"short"
,
InputManager
.
Instance
.
ShortMotionToInput
((
note
as
MotionNote
).
MotionName
)
},
{
"short"
,
manager
.
ShortMotionToInput
((
note
as
MotionNote
).
MotionName
)
},
{
"long"
,
InputManager
.
Instance
.
LongMotionToInput
((
note
as
MotionNote
).
MotionName
)
}
{
"long"
,
manager
.
LongMotionToInput
((
note
as
MotionNote
).
MotionName
)
}
};
};
return
new
Dictionary
<
string
,
InputStatus
>
return
new
Dictionary
<
string
,
InputStatus
>
{
{
{
"short"
,
InputManager
.
Instance
.
ShortButtonStat
},
{
"short"
,
manager
.
ShortButtonStat
},
{
"long"
,
InputManager
.
Instance
.
LongButtonStat
}
{
"long"
,
manager
.
LongButtonStat
}
};
};
}
}
public
static
bool
IsShortNoteEntered
(
Note
note
)
public
bool
IsShortNoteEntered
(
Note
note
)
{
{
return
JudgeInput
(
note
)[
"short"
]
==
InputStatus
.
Entered
;
return
JudgeInput
(
note
)[
"short"
]
==
InputStatus
.
Entered
;
}
}
public
static
bool
IsLongNoteStartCorrectly
(
Note
note
)
public
bool
IsLongNoteStartCorrectly
(
Note
note
)
{
{
return
JudgeInput
(
note
)[
"long"
]
==
InputStatus
.
Entered
&&
return
JudgeInput
(
note
)[
"long"
]
==
InputStatus
.
Entered
&&
!
note
.
Activated
;
!
note
.
Activated
;
}
}
public
static
bool
IsLongNoteHoldCorrectly
(
Note
note
)
public
bool
IsLongNoteHoldCorrectly
(
Note
note
)
{
{
var
stat
=
JudgeInput
(
note
);
var
stat
=
JudgeInput
(
note
);
return
(
return
(
...
@@ -317,14 +335,14 @@ public class JudgeManager : MonoBehaviour
...
@@ -317,14 +335,14 @@ public class JudgeManager : MonoBehaviour
note
.
Activated
;
note
.
Activated
;
}
}
public
static
bool
IsLongNoteFinishCorrectly
(
Note
note
,
float
timing
)
public
bool
IsLongNoteFinishCorrectly
(
Note
note
,
float
timing
)
{
{
return
JudgeInput
(
note
)[
"long"
]
==
InputStatus
.
Stopped
&&
return
JudgeInput
(
note
)[
"long"
]
==
InputStatus
.
Stopped
&&
note
.
Activated
&&
note
.
Activated
&&
Judge
.
IsNoteEnd
(
note
,
timing
);
Judge
.
IsNoteEnd
(
note
,
timing
);
}
}
public
static
bool
IsLongNoteFinishIncorrectly
(
Note
note
,
float
timing
)
public
bool
IsLongNoteFinishIncorrectly
(
Note
note
,
float
timing
)
{
{
var
stat
=
JudgeInput
(
note
);
var
stat
=
JudgeInput
(
note
);
return
stat
[
"long"
]
==
InputStatus
.
Stopped
&&
return
stat
[
"long"
]
==
InputStatus
.
Stopped
&&
...
@@ -334,7 +352,7 @@ public class JudgeManager : MonoBehaviour
...
@@ -334,7 +352,7 @@ public class JudgeManager : MonoBehaviour
);
);
}
}
public
static
bool
IsWrongInput
(
Note
note
)
public
bool
IsWrongInput
(
Note
note
)
{
{
var
stat
=
WrongInput
(
note
);
var
stat
=
WrongInput
(
note
);
return
stat
[
"short"
]
==
InputStatus
.
Entered
||
return
stat
[
"short"
]
==
InputStatus
.
Entered
||
...
@@ -342,7 +360,7 @@ public class JudgeManager : MonoBehaviour
...
@@ -342,7 +360,7 @@ public class JudgeManager : MonoBehaviour
stat
[
"long"
]
==
InputStatus
.
Continuing
;
stat
[
"long"
]
==
InputStatus
.
Continuing
;
}
}
public
static
bool
IsNoteBroken
(
Note
note
,
float
timing
,
Judge
judge
)
public
bool
IsNoteBroken
(
Note
note
,
float
timing
,
Judge
judge
)
{
{
return
note
.
IsLong
&&
return
note
.
IsLong
&&
!
Judge
.
IsNoteEnd
(
note
,
timing
)
&&
!
Judge
.
IsNoteEnd
(
note
,
timing
)
&&
...
@@ -384,7 +402,7 @@ class MotionGageManager
...
@@ -384,7 +402,7 @@ class MotionGageManager
public
float
UpdateTime
()
public
float
UpdateTime
()
{
{
elapsedTime
+=
Time
.
deltaTime
*
1000
;
elapsedTime
+=
(
Time
.
deltaTime
*
1000
)
;
return
elapsedTime
;
return
elapsedTime
;
}
}
...
...
Assets/Script/MotionView.cs
View file @
ed3a1d8e
...
@@ -6,22 +6,40 @@ using System.Linq;
...
@@ -6,22 +6,40 @@ using System.Linq;
public
class
MotionView
:
MonoBehaviour
public
class
MotionView
:
MonoBehaviour
{
{
CoordinateMapperManager
manager
;
InputManager
input
;
IEnumerable
<
KinectModule
.
IBody
>
body
;
IEnumerable
<
KinectModule
.
IBody
>
body
;
MotionDiscriminator
discriminator
=
new
MotionDiscriminator
();
MotionDiscriminator
discriminator
=
new
MotionDiscriminator
();
bool
IsInit
;
// Use this for initialization
// Use this for initialization
void
Start
()
void
Start
()
{
{
body
=
GameObject
.
Find
(
"Managers"
).
GetComponent
<
CoordinateMapperManager
>().
BodyBuffer
;
IsInit
=
false
;
discriminator
.
Preset
(
body
.
ToList
()[
0
]);
var
ingameManager
=
GameObject
.
Find
(
"InGameManagers"
);
manager
=
ingameManager
.
GetComponent
<
CoordinateMapperManager
>();
input
=
ingameManager
.
GetComponent
<
InputManager
>();
}
}
// Update is called once per frame
// Update is called once per frame
void
Update
()
void
Update
()
{
{
InputManager
.
Instance
.
CurrentMotionState
=
DetermineState
();
if
(
IsInit
)
}
{
input
.
CurrentMotionState
=
DetermineState
();
return
;
}
body
=
manager
.
BodyBuffer
;
var
tmp
=
body
.
ToList
()[
0
];
if
(
tmp
!=
null
)
{
discriminator
.
Preset
(
body
.
ToList
()[
0
]);
IsInit
=
true
;
}
}
MotionState
DetermineState
()
MotionState
DetermineState
()
{
{
...
...
Assets/Script/Tests/CoordinateMapperManagerTests.cs
View file @
ed3a1d8e
...
@@ -9,33 +9,6 @@ using System;
...
@@ -9,33 +9,6 @@ using System;
// TODO: Change IMGUI to uGUI
// TODO: Change IMGUI to uGUI
public
class
CoordinateMapperManagerTests
public
class
CoordinateMapperManagerTests
{
{
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[
UnityTest
]
public
IEnumerator
EmptyTest
()
{
// Use the Assert class to test conditions.
// yield to skip a frame
yield
return
null
;
}
[
UnityTest
]
public
IEnumerator
NullFrame_GUI_Show_When_Kinect_Disconnected
()
{
yield
return
null
;
}
[
UnityTest
]
public
IEnumerator
FPS_GUI_Show_When_Kinect_Disconnected
()
{
yield
return
null
;
}
[
UnityTest
]
public
IEnumerator
FPS_GUI_Show_When_Kinect_Connected
()
{
yield
return
null
;
}
[
UnityTest
]
[
UnityTest
]
public
IEnumerator
ColorTexture_Not_Equal_Null_When_Kinect_Disconnected
()
public
IEnumerator
ColorTexture_Not_Equal_Null_When_Kinect_Disconnected
()
{
{
...
...
Assets/Script/Tests/CoordinateMapperViewTests.cs
View file @
ed3a1d8e
...
@@ -41,7 +41,7 @@ class CoordinateMapperViewTests
...
@@ -41,7 +41,7 @@ class CoordinateMapperViewTests
CoordinateMapperManager
CreateManager
()
CoordinateMapperManager
CreateManager
()
{
{
var
manager
=
new
GameObject
(
"Managers"
);
var
manager
=
new
GameObject
(
"
InGame
Managers"
);
return
manager
.
AddComponent
<
CoordinateMapperManager
>();
return
manager
.
AddComponent
<
CoordinateMapperManager
>();
}
}
...
...
Assets/Script/Tests/InputManagerTests.cs
0 → 100644
View file @
ed3a1d8e
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
UnityEngine
;
using
UnityEngine.TestTools
;
using
NUnit.Framework
;
using
System.Collections
;
// keyboard event => next frame => ButtonStat
class
InputManagerTests
{
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[
UnityTest
]
public
IEnumerator
EmptyTest
()
{
// Use the Assert class to test conditions.
// yield to skip a frame
yield
return
null
;
yield
return
null
;
yield
return
null
;
}
[
UnityTest
]
public
IEnumerator
ShortButtonStat_Equal_None_When_After_One_Keyboard_Event
()
{
var
obj
=
new
GameObject
();
yield
return
null
;
}
}
Assets/Script/Tests/InputManagerTests.cs.meta
0 → 100644
View file @
ed3a1d8e
fileFormatVersion: 2
guid: 6e827d1ccd3c1ee44931742328a640b3
timeCreated: 1516873575
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Script/TrackInfo.cs
View file @
ed3a1d8e
...
@@ -16,7 +16,7 @@ public class TrackInfo
...
@@ -16,7 +16,7 @@ public class TrackInfo
public
float
BeatInterval
public
float
BeatInterval
{
get
{
return
4
*
60
*
1000f
/
BPM
;
}
}
{
get
{
return
4
*
60
*
1000f
/
BPM
;
}
}
public
AudioSource
BGM
{
get
;
private
set
;
}
public
string
BGM
{
get
;
private
set
;
}
public
List
<
string
>
TrackList
{
get
;
private
set
;
}
public
List
<
string
>
TrackList
{
get
;
private
set
;
}
...
@@ -151,7 +151,7 @@ internal class TrackHeader
...
@@ -151,7 +151,7 @@ internal class TrackHeader
public
string
Genre
{
get
;
private
set
;
}
public
string
Genre
{
get
;
private
set
;
}
public
float
BPM
{
get
;
private
set
;
}
public
float
BPM
{
get
;
private
set
;
}
public
int
Level
{
get
;
private
set
;
}
public
int
Level
{
get
;
private
set
;
}
public
AudioSource
BGM
{
get
;
private
set
;
}
public
string
BGM
{
get
;
private
set
;
}
public
List
<
string
>
TrackList
{
get
;
private
set
;
}
public
List
<
string
>
TrackList
{
get
;
private
set
;
}
public
public
...
@@ -159,27 +159,25 @@ internal class TrackHeader
...
@@ -159,27 +159,25 @@ internal class TrackHeader
ExtractHeader
(
ExtractHeader
(
MultiDictionary
<
string
,
string
>
parseResult
)
MultiDictionary
<
string
,
string
>
parseResult
)
{
{
Title
=
ExtractMetaString
(
Title
=
ExtractMetaString
(
parseResult
,
parseResult
,
"#TITLE"
);
"#TITLE"
);
Artist
=
ExtractMetaString
(
Artist
=
ExtractMetaString
(
parseResult
,
parseResult
,
"#ARTIST"
);
"#ARTIST"
);
Genre
=
ExtractMetaString
(
Genre
=
ExtractMetaString
(
parseResult
,
parseResult
,
"#GENRE"
);
"#GENRE"
);
BPM
=
ExtractBPM
(
BPM
=
ExtractBPM
(
parseResult
);
parseResult
);
Level
=
ExtractLevel
(
Level
=
ExtractLevel
(
parseResult
);
parseResult
);
TrackList
=
ExtractMetaList
(
TrackList
=
ExtractMetaList
(
parseResult
,
parseResult
,
"#TRACKLIST"
);
"#TRACKLIST"
);
BGM
=
Resources
.
Load
(
BGM
=
ExtractMetaString
(
ExtractMetaString
(
parseResult
,
parseResult
,
"#WAV"
);
"#WAV"
))
as
AudioSource
;
}
}
private
private
...
...
Assets/Script/TrackManager.cs
View file @
ed3a1d8e
...
@@ -41,7 +41,7 @@ public class TrackManager : MonoBehaviour {
...
@@ -41,7 +41,7 @@ public class TrackManager : MonoBehaviour {
}
}
bool
IsPressedStart
bool
IsPressedStart
{
get
{
return
Input
Manager
.
Instance
.
ButtonStat
==
ButtonStatus
.
Pressed
;
}
}
{
get
{
return
Input
.
GetKey
(
KeyCode
.
Space
)
;
}
}
// Use this for initialization
// Use this for initialization
void
Start
()
void
Start
()
...
@@ -135,8 +135,7 @@ public class TrackManager : MonoBehaviour {
...
@@ -135,8 +135,7 @@ public class TrackManager : MonoBehaviour {
// TODO: disable start button if nothing selected
// TODO: disable start button if nothing selected
GameManager
.
Instance
.
CurrentTrack
=
selected
.
GetComponent
<
TrackInfoHolder
>().
trackInfo
;
GameManager
.
Instance
.
CurrentTrack
=
selected
.
GetComponent
<
TrackInfoHolder
>().
trackInfo
;
Destroy
(
GetComponent
<
InputManager
>());
Destroy
(
this
);
Destroy
(
this
);
GameManager
.
Instance
.
SceneTransition
(
"InGame"
);
GameManager
.
Instance
.
SceneTransition
(
"InGame"
);
...
...
Assets/Tracks/Test/Bigroom1.bpe
View file @
ed3a1d8e
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
#BPM 128
#BPM 128
#PLAYLEVEL 0
#PLAYLEVEL 0
#WAV Bigroom1
#000SBT AA00
#000SBT AA00
#004SBT AAAAAAAA
#004SBT AAAAAAAA
#005SBT AAAAAAAA
#005SBT AAAAAAAA
...
...
Assets/Tracks/Test/JJR.bpe
View file @
ed3a1d8e
...
@@ -8,5 +8,7 @@
...
@@ -8,5 +8,7 @@
#TRACKLIST Probably - Amumal
#TRACKLIST Probably - Amumal
#TRACKLIST PARANOiA - Revolution
#TRACKLIST PARANOiA - Revolution
#WAV REC001
#002SMO JPJPJPJP
#002SMO JPJPJPJP
#003SMO JPJPJPJP
#003SMO JPJPJPJP
Assets/Tracks/Tutorial/tmp.bpe
0 → 100644
View file @
ed3a1d8e
#TITLE test
#ARTIST asdf
#GENRE asdf
#BPM 120
#PLAYLEVEL 0
#000SBT 00AA00AA
#001SBT 00AA00AA
#002SBT 00AA00AA
#003SBT 00AA00AA
#004SBT 00AA00AA
#015SBT 00AA00AA
#025SBT 00AA00AA
#035SBT 00AA00AA
#045SBT 00AA00AA
#055SBT 00AA00AA
#065SBT 00AA00AA
#075SBT 00AA00AA
#085SBT 00AA00AA
#095SBT 00AA00AA
#105SBT 00AA00AA
#115SBT 00AA00AA
#125SBT 00AA00AA
#135SBT 00AA00AA
#145SBT 00AA00AA
#155SBT 00AA00AA
\ No newline at end of file
Assets/Tracks/Tutorial/tmp.bpe.meta
0 → 100644
View file @
ed3a1d8e
fileFormatVersion: 2
guid: 28b00014f89894a4b9eff7574541cf9c
timeCreated: 1516862638
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
ProjectSettings/EditorBuildSettings.asset
View file @
ed3a1d8e
...
@@ -20,3 +20,6 @@ EditorBuildSettings:
...
@@ -20,3 +20,6 @@ EditorBuildSettings:
-
enabled
:
1
-
enabled
:
1
path
:
Assets/Scene/Result.unity
path
:
Assets/Scene/Result.unity
guid
:
610cc3a14d437e44bb9e6ba385e05136
guid
:
610cc3a14d437e44bb9e6ba385e05136
-
enabled
:
1
path
:
Assets/Scene/tmp.unity
guid
:
bd1125abc59508941a9858dc3f08c1b7
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