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