Commit 6e0695fb authored by Chae Ho Shin's avatar Chae Ho Shin
parents 11afaddb 4f6bf12b
...@@ -18,23 +18,41 @@ public class Jump : MotionNote ...@@ -18,23 +18,41 @@ public class Jump : MotionNote
} }
public Jump(float timing) : base(timing) public Jump(float timing) : base(timing)
{ {
downCount = 0;
} }
private float spineHeight;
private int downCount;
public override IEnumerator Checkpoint() public override IEnumerator Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; float currentSpineHeight
var motion = motionState; = InputManager.Instance
.Joints[Windows.Kinect.JointType.SpineBase].Position.Y;
while (downCount < 10 && currentSpineHeight <= spineHeight - 0.1f)
{
spineHeight = currentSpineHeight;
currentSpineHeight
= InputManager.Instance
.Joints[Windows.Kinect.JointType.SpineBase].Position.Y;
while (motion != MotionState.CLAP_PREPARE) downCount++;
yield return false; yield return false;
}
Activated = true; if (downCount >= 10)
Activated = true;
yield break; yield break;
} }
public override bool FinalJudgeAction() public override bool FinalJudgeAction()
{ {
throw new NotImplementedException(); float currentSpineHeight
= InputManager.Instance
.Joints[Windows.Kinect.JointType.SpineBase].Position.Y;
return currentSpineHeight >= spineHeight;
} }
} }
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using Windows.Kinect;
using System.IO; using System.IO;
using UnityEngine.UI; using UnityEngine.UI;
...@@ -29,6 +30,7 @@ public class InputManager : MonoBehaviour { ...@@ -29,6 +30,7 @@ public class InputManager : MonoBehaviour {
} }
public MotionState CurrentMotionState { get; set; } public MotionState CurrentMotionState { get; set; }
public Dictionary<JointType, Windows.Kinect.Joint> Joints { get; set; }
public bool IsButtonPressed public bool IsButtonPressed
{ {
......
...@@ -73,6 +73,7 @@ public class JudgeManager : MonoBehaviour ...@@ -73,6 +73,7 @@ public class JudgeManager : MonoBehaviour
activatedNotes = new List<MotionNote>(); activatedNotes = new List<MotionNote>();
LoadNotes(GameManager.Instance.CurrentTrack.Notes); LoadNotes(GameManager.Instance.CurrentTrack.Notes);
Instantiate(GameManager.Instance.CurrentTrack.BGM);
} }
// Update is called once per frame // Update is called once per frame
......
...@@ -52,16 +52,22 @@ public class MotionView : MonoBehaviour { ...@@ -52,16 +52,22 @@ public class MotionView : MonoBehaviour {
leftHand = body[idx].Joints[JointType.HandLeft ] leftHand = body[idx].Joints[JointType.HandLeft ]
.Position, .Position,
rightHand = body[idx].Joints[JointType.HandRight] rightHand = body[idx].Joints[JointType.HandRight]
.Position; .Position,
spineShoulder = body[idx].Joints[JointType.SpineShoulder]
.Position;
MotionState s = MotionState.UNKNOWN; MotionState s = MotionState.UNKNOWN;
if (head.Y < leftHand.Y && head.Y < rightHand.Y) if (head.Y < leftHand.Y && head.Y < rightHand.Y)
s |= MotionState.HURRAY; s |= MotionState.HURRAY;
if (Distance(leftHand, rightHand) > 0.3f) if (Distance(leftHand, rightHand) > 0.3f
&& spineShoulder.Y < leftHand.Y && spineShoulder.Y < rightHand.Y)
s |= MotionState.CLAP_PREPARE; s |= MotionState.CLAP_PREPARE;
if (Distance(leftHand, rightHand) < 0.1f) if (Distance(leftHand, rightHand) < 0.1f
&& spineShoulder.Y < leftHand.Y && spineShoulder.Y < rightHand.Y)
s |= MotionState.CLAP_DONE; s |= MotionState.CLAP_DONE;
InputManager.Instance.Joints = body[idx].Joints;
return s; return s;
} }
......
...@@ -12,6 +12,8 @@ public class TrackInfo ...@@ -12,6 +12,8 @@ public class TrackInfo
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 AudioClip BGM { get; private set; }
public List<string> TrackList { get; private set; } public List<string> TrackList { get; private set; }
public List<Note> Notes { get; private set; } public List<Note> Notes { get; private set; }
...@@ -68,6 +70,9 @@ public class TrackInfo ...@@ -68,6 +70,9 @@ public class TrackInfo
case "#TRACKLIST": case "#TRACKLIST":
TrackList.Add(value); TrackList.Add(value);
break; break;
case "#WAV":
BGM = new WWW("file:///" + file.DirectoryName + '\\' + value).GetAudioClip();
break;
} }
} }
} }
......
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