Commit cf75c447 authored by 16도재형's avatar 16도재형

Merge branch 'master' of https://git.kucatdog.net/eseiker/ButtonPusher

# Conflicts:
#	Assets/MotionNotes/Clap.cs
#	Assets/MotionNotes/Guard.cs
#	Assets/MotionNotes/HandDown.cs.meta
#	Assets/MotionNotes/Jump.cs
#	Assets/MotionNotes/PushUp.cs
#	Assets/Script/MotionNote.cs
parents d618a691 264d73d3
......@@ -22,13 +22,33 @@ public class Clap : MotionNote
public override void Checkpoint()
{
<<<<<<< HEAD
IsChecked = (InputManager.Instance.CurrentMotionState
& MotionState.CLAP_PREPARE) != 0;
=======
var motion = InputManager.Instance.CurrentMotionState;
if ((motion & MotionState.CLAP_PREPARE) == 0)
return;
IsChecked = true;
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
}
public override bool FinalJudgeAction()
{
<<<<<<< HEAD
return (InputManager.Instance.CurrentMotionState
& MotionState.CLAP_DONE) != 0;
=======
var motion = InputManager.Instance.CurrentMotionState;
if (IsChecked && (motion & MotionState.CLAP_DONE) != 0)
{
return true;
}
return false;
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
}
}
......@@ -7,18 +7,51 @@ public class Guard : MotionNote
enum Hand { Both, Left, Right }
Hand hand;
<<<<<<< HEAD
MotionState prepare, done;
private static Sprite image;
=======
private static Sprite imageB = LoadNewSprite("");
private static Sprite imageL = LoadNewSprite("");
private static Sprite imageR = LoadNewSprite("");
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
public override Sprite Image
{
get
{
return image;
switch (hand)
{
default:
case Hand.Both:
return imageB;
case Hand.Left:
return imageL;
case Hand.Right:
return imageR;
}
}
}
private bool isChecked = false;
public override bool IsChecked
{
get
{
return isChecked;
}
}
<<<<<<< HEAD
public Guard(string key, float timing) : this(timing)
=======
public Guard(string key, float timing) : this(key, timing, 0f)
{
}
public Guard(string key, float timing, float end = 0f) : this(timing, end)
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
{
switch (key)
{
......@@ -52,7 +85,11 @@ public class Guard : MotionNote
{
}
<<<<<<< HEAD
public override void Checkpoint()
=======
public override IEnumerator Checkpoint(MotionNote obj)
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
{
IsChecked = (InputManager.Instance.CurrentMotionState
& prepare) != 0;
......@@ -60,7 +97,11 @@ public class Guard : MotionNote
public override bool FinalJudgeAction()
{
<<<<<<< HEAD
return (InputManager.Instance.CurrentMotionState
& done) != 0;
=======
return false;
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
}
}
......@@ -20,10 +20,46 @@ public class Jump : MotionNote
{
}
<<<<<<< HEAD
public override void Checkpoint()
{
IsChecked = (InputManager.Instance.CurrentMotionState
& MotionState.JUMP_PREPARE) != 0;
=======
private bool isChecked = false;
public override bool IsChecked
{
get
{
return isChecked;
}
}
private float spineHeight = 0f;
private int downCount;
public override IEnumerator Checkpoint(MotionNote obj)
{
float currentSpineHeight
= InputManager.Instance
.Joints[Windows.Kinect.JointType.SpineBase].Position.Y;
while (spineHeight == 0f || downCount < 10 && currentSpineHeight <= spineHeight - 0.1f)
{
spineHeight = currentSpineHeight;
currentSpineHeight
= InputManager.Instance
.Joints[Windows.Kinect.JointType.SpineBase].Position.Y;
downCount++;
yield return false;
}
if (downCount >= 10)
Activated = true;
yield break;
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
}
public override bool FinalJudgeAction()
......
......@@ -46,7 +46,20 @@ public class PushUp : MotionNote
{
}
<<<<<<< HEAD
public override void Checkpoint()
=======
private bool isChecked = false;
public override bool IsChecked
{
get
{
return isChecked;
}
}
public override IEnumerator Checkpoint(MotionNote obj)
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
{
IsChecked = (InputManager.Instance.CurrentMotionState
& prepare) != 0;
......
......@@ -90,7 +90,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 0.627451}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
......@@ -117,7 +117,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
......@@ -144,7 +144,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
......@@ -219,7 +219,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 30, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 3, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224619449702362956
......@@ -237,8 +237,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 15, y: 0}
m_SizeDelta: {x: 30, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 3, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224834283073951364
RectTransform:
......
......@@ -66,7 +66,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1870857072681458}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 5.5, z: -1.6}
m_LocalPosition: {x: 0, y: 6.5, z: -3}
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
m_Children:
- {fileID: 4514239179313720}
......
......@@ -1924,8 +1924,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 80}
m_SizeDelta: {x: 120, y: 120}
m_AnchoredPosition: {x: 0, y: 200}
m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1173591430
MonoBehaviour:
......
......@@ -117,6 +117,7 @@ GameObject:
m_Component:
- component: {fileID: 1829858}
- component: {fileID: 1829857}
- component: {fileID: 1829859}
m_Layer: 0
m_Name: Score Display Manager
m_TagString: Untagged
......@@ -154,6 +155,17 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1829859
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1829856}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6e697643158480b4ba850d906eac1bc2, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &8282761
GameObject:
m_ObjectHideFlags: 0
......@@ -1058,7 +1070,7 @@ RectTransform:
- {fileID: 1677681266}
- {fileID: 244884906}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
......@@ -1130,92 +1142,31 @@ MonoBehaviour:
m_GameObject: {fileID: 1243499222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -98529514, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 0.712}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1243499228
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1243499222}
--- !u!1 &1570306258
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1570306261}
- component: {fileID: 1570306260}
- component: {fileID: 1570306259}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1570306259
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1570306258}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1570306260
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1570306258}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &1570306261
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1570306258}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1667908250
GameObject:
m_ObjectHideFlags: 0
......
......@@ -132,7 +132,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 236248255}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1741478284}
......
......@@ -56,8 +56,9 @@ public class GameManager : MonoBehaviour {
{
}
public void SceneTransition(string sceneName)
public void SceneTransition(string sceneName, bool additive = false)
{
SceneManager.LoadScene("Scene/" + sceneName);
SceneManager.LoadScene("Scene/" + sceneName,
additive ? LoadSceneMode.Additive : LoadSceneMode.Single);
}
}
......@@ -17,7 +17,7 @@ public class Judge
private Judge()
{
ButtonTimingRange = 0f;
MotionTimingRange = ButtonTimingRange;
ButtonTimingRange = 0f;
Score = 0;
IsBreak = false;
Color = Color.black;
......@@ -28,20 +28,22 @@ public class Judge
public string Name { get; private set; }
public float ButtonTimingRange { get; private set; }
public float MotionTimingRange { 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 MISS = JudgeList.Last();
private static readonly
public static readonly
float MaxButtonTimingRange = JudgeList[2].ButtonTimingRange;
public static Judge TestJudge(Note note, float elapsedTime, bool end = false)
public static Judge TestJudge(Note note, float elapsedTime, bool end = false, bool test = false)
{
float timing = end ? note.EndTiming : note.StartTiming;
float difference = Mathf.Abs(elapsedTime - timing);
if (test)
Debug.Log(elapsedTime - timing);
foreach (Judge judge in JudgeList)
{
if (difference < judge.ButtonTimingRange)
......
......@@ -24,6 +24,7 @@ public class JudgeManager : MonoBehaviour
float latency = 225f;
float scrollMultiplier = 1.0f;
float startOffset = -5f;
private GameObject offset;
private GameObject noteobj, smobj, lmobj;
......@@ -36,8 +37,6 @@ public class JudgeManager : MonoBehaviour
private float elapsedTime = 0;
private List<MotionNote> activatedNotes;
private float MsPerBeat
{
get
......@@ -54,6 +53,32 @@ public class JudgeManager : MonoBehaviour
}
}
private float elapsedMotion;
private float motionTimeout;
private void MotionGuageReset(float timeout = 0f)
{
if (timeout <= 0f)
{
elapsedMotion = 0f;
motionGuage.transform.parent.gameObject.SetActive(false);
return;
}
motionTimeout = timeout;
motionGuage.transform.parent.gameObject.SetActive(true);
motionGuage.SetActive(true);
}
private void MotionGuageUpdate()
{
if (motionGuage.transform.parent.gameObject.activeInHierarchy)
elapsedMotion += Time.deltaTime * 1000f;
if (elapsedMotion >= motionTimeout)
MotionGuageReset();
else
motionGuage.GetComponent<Image>().fillAmount = elapsedMotion / motionTimeout;
}
// Use this for initialization
void Start()
{
......@@ -68,9 +93,7 @@ public class JudgeManager : MonoBehaviour
initialPos = offset.transform.position;
judgeText.SetActive(false);
motionGuage.transform.parent.gameObject.SetActive(false);
activatedNotes = new List<MotionNote>();
MotionGuageReset();
LoadNotes(GameManager.Instance.CurrentTrack.Notes);
Instantiate(GameManager.Instance.CurrentTrack.BGM);
......@@ -80,10 +103,17 @@ public class JudgeManager : MonoBehaviour
void Update()
{
elapsedTime += Time.deltaTime * 1000;
float timing = elapsedTime + latency;
float timing = elapsedTime;
offset.transform.position = new Vector3(-timing * ScrollSpeed, 0, 0);
MotionGuageUpdate();
if (noteobj.transform.childCount <= 0
&& smobj.transform.childCount <= 0
&& lmobj.transform.childCount <= 0)
Invoke("ShowResult", 2f);
new Action(() =>
{
if (noteobj.transform.childCount <= 0)
......@@ -105,7 +135,7 @@ public class JudgeManager : MonoBehaviour
}
if (InputManager.Instance.IsButtonReleased)
{
SetJudge(Judge.TestJudge(note, timing, true));
SetJudge(Judge.TestJudge(note, timing), true);
DeactivateNote(note);
return;
}
......@@ -143,29 +173,41 @@ public class JudgeManager : MonoBehaviour
GameObject smo = smobj.transform.GetChild(0).gameObject;
MotionNote smnote = (MotionNote)smo.GetComponent<Note.Controller>().Instance;
if (!smnote.Activated && elapsedTime >= (smnote.StartTiming - MsPerBeat))
smnote.Checkpoint();
if (!smnote.Activated && timing >= (smnote.StartTiming - MsPerBeat))
{
GameObject motionSample = Instantiate(motionSampleDisplayPrefab);
MotionSampleDisplay msd = motionSample.GetComponent<MotionSampleDisplay>();
msd.sprite = smnote.Image;
msd.timeout = MsPerBeat*2;
smnote.Activated = true;
msd.timeout = MsPerBeat;
smnote.MotionSampleDisplay = msd;
activatedNotes.Add(smnote);
smnote.Activated = true;
}
if(timing >= (smnote.StartTiming - Judge.MaxButtonTimingRange))
{
if (smnote.FinalJudgeAction() || (timing > (smnote.EndTiming + Judge.MaxButtonTimingRange)))
{
SetJudge(Judge.TestJudge(smnote, timing, true), true);
DeactivateNote(smnote);
}
}
// Debug.Log("T: " + timing + " nQ: " + activatedNotes.Count);
/*
for(int i=activatedNotes.Count-1;i>=0;i--)
{
MotionNote note = activatedNotes[i];
if (note.FinalJudgeAction() || elapsedTime > note.EndTiming + Judge.MISS.MotionTimingRange)
if (note.FinalJudgeAction() || (timing > (note.EndTiming + Judge.MaxButtonTimingRange)))
{
SetJudge(Judge.TestJudge(note, timing, true));
SetJudge(Judge.TestJudge(note, timing + 350, false), true);
activatedNotes.RemoveAt(i);
DeactivateNote(note);
}
}
}*/
})();
/*
new Action(() =>
{
if (lmobj.transform.childCount <= 0)
......@@ -176,14 +218,33 @@ public class JudgeManager : MonoBehaviour
lmnote.Checkpoint();
if (lmnote.Activated)
if (!lmnote.Activated && elapsedTime >= (lmnote.StartTiming - MsPerBeat))
{
SetJudge(Judge.TestJudge(lmnote, timing));
DeactivateNote(lmnote);
GameObject motionSample = Instantiate(motionSampleDisplayPrefab);
MotionSampleDisplay msd = motionSample.GetComponent<MotionSampleDisplay>();
msd.sprite = lmnote.Image;
msd.timeout = MsPerBeat;
lmnote.Activated = true;
lmnote.MotionSampleDisplay = msd;
activatedNotes.Add(lmnote);
}
return;
for (int i = activatedNotes.Count - 1; i >= 0; i--)
{
MotionNote note = activatedNotes[i];
if (elapsedTime > note.StartTiming)
MotionGuageReset(note.Length);
if (note.FinalJudgeAction() || elapsedTime > note.EndTiming + Judge.MaxButtonTimingRange)
{
SetJudge(Judge.TestJudge(note, timing, true));
activatedNotes.RemoveAt(i);
DeactivateNote(note);
MotionGuageReset();
}
}
})();
*/
}
private void DeactivateNote(Note note)
......@@ -202,9 +263,7 @@ public class JudgeManager : MonoBehaviour
GameManager.Instance.Score += judge.Score;
GameManager.Instance.JudgeCount[judge]++;
Debug.Log(judge.Name + (isMotion ? " Motion" : " Note"));
Debug.Log(GameManager.Instance.Combo);
Debug.Log(GameManager.Instance.LongestCombo);
Debug.Log(judge.Name + (isMotion ? " Motion" : " Note") + " Combo: " + GameManager.Instance.Combo);
judgeText.SetActive(true);
judgeText.GetComponent<Text>().text = judge.Name;
......@@ -248,4 +307,15 @@ public class JudgeManager : MonoBehaviour
obj.AddComponent<Note.Controller>().Instance = note;
}
}
private bool onResult = false;
private void ShowResult()
{
if (!onResult)
{
GameManager.Instance.SceneTransition("Result", true);
onResult = true;
}
}
}
......@@ -24,6 +24,7 @@ public abstract class MotionNote : Note
= new Dictionary<string, Type>
{
{ "CP", typeof(Clap) },
<<<<<<< HEAD
{ "JP", typeof(Jump) },
......@@ -55,6 +56,8 @@ public abstract class MotionNote : Note
{ "RH", typeof(Headphone) },
{ "OT", typeof(OnTheTable) },
=======
>>>>>>> 264d73d3155335b370d118cddd1ace963868a28c
};
protected static Sprite LoadNewSprite(string FilePath, float PixelsPerUnit = 100.0f)
......
......@@ -15,7 +15,7 @@ public class MotionSampleDisplay : MonoBehaviour
private float velocity;
private float acceleration;
private float distance = 3f;
private float distance = 1.5f;
// Use this for initialization
void Start()
......
......@@ -62,6 +62,9 @@ public class TrackManager : MonoBehaviour {
// Update is called once per frame
void Update()
{
if (trackList.transform.childCount < 0)
return;
if (Input.GetKeyDown(KeyCode.DownArrow))
{
trackList.transform.GetChild(0).SetAsLastSibling();
......
#TITLE Jump Jump Revolution
#ARTIST 128
#GENRE None
#BPM 128
#PLAYLEVEL 0
#TRACKLIST Something - Someone
#TRACKLIST Probably - Amumal
#TRACKLIST PARANOiA - Revolution
#002SMO JPJPJPJP
#003SMO JPJPJPJP
fileFormatVersion: 2
guid: a0ed6224ca6bb234085d194a31e2a3c1
timeCreated: 1503617877
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 16201f7e6e6532143b745bb09761c13b
timeCreated: 1503611397
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
......@@ -4,6 +4,8 @@
#BPM 128
#PLAYLEVEL 0
#WAV Test.wav
#TRACKLIST Something - Someone
#TRACKLIST Probably - Amumal
#TRACKLIST PARANOiA - Revolution
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment