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

모션노트 완료

parent 89b2c3b3
...@@ -20,25 +20,15 @@ public class Clap : MotionNote ...@@ -20,25 +20,15 @@ public class Clap : MotionNote
{ {
} }
public override IEnumerator Checkpoint() public override void Checkpoint()
{ {
var motion = InputManager.Instance.CurrentMotionState; IsChecked = (InputManager.Instance.CurrentMotionState
& MotionState.CLAP_PREPARE) != 0;
while ((motion & MotionState.CLAP_PREPARE) == 0)
yield return null;
IsChecked = true;
yield break;
} }
public override bool FinalJudgeAction() public override bool FinalJudgeAction()
{ {
var motion = InputManager.Instance.CurrentMotionState; return (InputManager.Instance.CurrentMotionState
& MotionState.CLAP_DONE) != 0;
if ((motion & MotionState.CLAP_DONE) != 0)
return true;
return false;
} }
} }
...@@ -7,7 +7,9 @@ public class Guard : MotionNote ...@@ -7,7 +7,9 @@ public class Guard : MotionNote
enum Hand { Both, Left, Right } enum Hand { Both, Left, Right }
Hand hand; Hand hand;
private static Sprite image = LoadNewSprite(""); MotionState prepare, done;
private static Sprite image;
public override Sprite Image public override Sprite Image
{ {
get get
...@@ -16,40 +18,49 @@ public class Guard : MotionNote ...@@ -16,40 +18,49 @@ public class Guard : MotionNote
} }
} }
public Guard(string key, float timing, float end = 0f) : this(timing, end) public Guard(string key, float timing) : this(timing)
{ {
switch (key) switch (key)
{ {
case "BG": case "BG":
hand = Hand.Both; hand = Hand.Both;
image = LoadNewSprite("BG");
prepare = MotionState.GUARD_BASE_LEFT | MotionState.GUARD_BASE_RIGHT
| MotionState.HAND_MOVE_DOWN_LEFT | MotionState.HAND_MOVE_DOWN_RIGHT;
done = MotionState.GUARD_BASE_LEFT | MotionState.GUARD_BASE_RIGHT
| MotionState.HAND_MOVE_UP_LEFT | MotionState.HAND_MOVE_UP_RIGHT;
break; break;
case "LG": case "LG":
hand = Hand.Left; hand = Hand.Left;
image = LoadNewSprite("LG");
prepare = MotionState.GUARD_BASE_LEFT
| MotionState.HAND_MOVE_DOWN_LEFT;
done = MotionState.GUARD_BASE_LEFT
| MotionState.HAND_MOVE_UP_LEFT;
break; break;
case "RG": case "RG":
hand = Hand.Right; hand = Hand.Right;
image = LoadNewSprite("RG");
prepare = MotionState.GUARD_BASE_RIGHT
| MotionState.HAND_MOVE_DOWN_RIGHT;
done = MotionState.GUARD_BASE_RIGHT
| MotionState.HAND_MOVE_UP_RIGHT;
break; break;
} }
} }
public Guard(float timing, float end = 0f) : base(timing, end) public Guard(float timing) : base(timing)
{ {
} }
public override IEnumerator Checkpoint() public override void Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; IsChecked = (InputManager.Instance.CurrentMotionState
var motion = motionState; & prepare) != 0;
while (motion != MotionState.CLAP_PREPARE)
yield return false;
Activated = true;
yield break;
} }
public override bool FinalJudgeAction() public override bool FinalJudgeAction()
{ {
throw new NotImplementedException(); return (InputManager.Instance.CurrentMotionState
& done) != 0;
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9335418863367cf4fb5c77889556b26a guid: 9335418863367cf4fb5c77889556b26a
timeCreated: 1503548782 timeCreated: 1503639949
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
serializedVersion: 2 serializedVersion: 2
......
using System;
using System.Collections;
using UnityEngine;
public class HandDown : MotionNote
{
enum Hand { Both, Left, Right }
Hand hand;
MotionState done;
private static Sprite image;
public override Sprite Image
{
get
{
return image;
}
}
public HandDown(string key, float timing) : this(timing)
{
switch (key)
{
case "BD":
hand = Hand.Both;
image = LoadNewSprite("BD");
done = MotionState.HAND_DOWN_LEFT | MotionState.HAND_DOWN_RIGHT;
break;
case "LD":
hand = Hand.Left;
image = LoadNewSprite("LD");
done = MotionState.HAND_DOWN_LEFT;
break;
case "RD":
hand = Hand.Right;
image = LoadNewSprite("RD");
done = MotionState.HAND_DOWN_RIGHT;
break;
}
}
public HandDown(float timing) : base(timing)
{
}
public override void Checkpoint()
{
IsChecked = true;
}
public override bool FinalJudgeAction()
{
return (InputManager.Instance.CurrentMotionState
& done) != 0;
}
}
fileFormatVersion: 2 fileFormatVersion: 2
guid: e943dcff2ea00af40acbfc09b7345f25 guid: 0a95b7cf44f588a478ab3d020a20d647
timeCreated: 1503548782 timeCreated: 1503640030
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
serializedVersion: 2 serializedVersion: 2
......
using System; using System;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;
public class Piano : MotionNote public class HandUp : MotionNote
{ {
enum Hand { Both, Left, Right } enum Hand { Both, Left, Right }
Hand hand; Hand hand;
private static Sprite image = LoadNewSprite(""); MotionState done;
private static Sprite image;
public override Sprite Image public override Sprite Image
{ {
get get
...@@ -16,40 +18,39 @@ public class Piano : MotionNote ...@@ -16,40 +18,39 @@ public class Piano : MotionNote
} }
} }
public Piano(string key, float timing) : this(timing) public HandUp(string key, float timing) : this(timing)
{ {
switch (key) switch (key)
{ {
case "BI": case "BU":
hand = Hand.Both; hand = Hand.Both;
image = LoadNewSprite("BU");
done = MotionState.HAND_UP_LEFT | MotionState.HAND_UP_RIGHT;
break; break;
case "LI": case "LU":
hand = Hand.Left; hand = Hand.Left;
image = LoadNewSprite("LU");
done = MotionState.HAND_UP_LEFT;
break; break;
case "RI": case "RU":
hand = Hand.Right; hand = Hand.Right;
image = LoadNewSprite("RU");
done = MotionState.HAND_UP_RIGHT;
break; break;
} }
} }
public Piano(float timing) : base(timing) public HandUp(float timing) : base(timing)
{ {
} }
public override IEnumerator Checkpoint() public override void Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; IsChecked = true;
var motion = motionState;
while (motion != MotionState.CLAP_PREPARE)
yield return false;
Activated = true;
yield break;
} }
public override bool FinalJudgeAction() public override bool FinalJudgeAction()
{ {
throw new NotImplementedException(); return (InputManager.Instance.CurrentMotionState
& done) != 0;
} }
} }
fileFormatVersion: 2
guid: be9752588c388ac4d985d31009c56a33
timeCreated: 1503640021
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using UnityEngine;
public class Headphone : MotionNote
{
enum Hand { Both, Left, Right }
Hand hand;
MotionState done;
private static Sprite image;
public override Sprite Image
{
get
{
return image;
}
}
public Headphone(string key, float timing) : this(timing)
{
switch (key)
{
case "BH":
hand = Hand.Both;
image = LoadNewSprite("BH");
done = MotionState.HEADPHONE_LEFT | MotionState.HEADPHONE_RIGHT;
break;
case "LH":
hand = Hand.Left;
image = LoadNewSprite("LH");
done = MotionState.HEADPHONE_LEFT;
break;
case "RH":
hand = Hand.Right;
image = LoadNewSprite("RH");
done = MotionState.HEADPHONE_RIGHT;
break;
}
}
public Headphone(float timing) : base(timing)
{
}
public override void Checkpoint()
{
IsChecked = true;
}
public override bool FinalJudgeAction()
{
return (InputManager.Instance.CurrentMotionState
& done) != 0;
}
}
fileFormatVersion: 2
guid: 7001b42f9e2553a4cb28935d34b516be
timeCreated: 1503640044
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using UnityEngine;
public class Jesus : MotionNote
{
private static Sprite image = LoadNewSprite("Assets/MotionNotes/JP.png");
public override Sprite Image
{
get
{
return image;
}
}
public Jesus(string key, float timing) : this(timing)
{
}
public Jesus(float timing) : base(timing)
{
}
public override void Checkpoint()
{
IsChecked = true;
}
public override bool FinalJudgeAction()
{
return (InputManager.Instance.CurrentMotionState
& MotionState.JESUS) != 0;
}
}
fileFormatVersion: 2
guid: 15c3b7e2e4c349745a04b348f255f6ca
timeCreated: 1503640038
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -4,7 +4,7 @@ using UnityEngine; ...@@ -4,7 +4,7 @@ using UnityEngine;
public class Jump : MotionNote public class Jump : MotionNote
{ {
private static Sprite image = new Sprite(); private static Sprite image = LoadNewSprite("Assets/MotionNotes/JP.png");
public override Sprite Image public override Sprite Image
{ {
get get
...@@ -18,41 +18,17 @@ public class Jump : MotionNote ...@@ -18,41 +18,17 @@ public class Jump : MotionNote
} }
public Jump(float timing) : base(timing) public Jump(float timing) : base(timing)
{ {
downCount = 0;
} }
private float spineHeight; public override void Checkpoint()
private int downCount;
public override IEnumerator Checkpoint()
{ {
float currentSpineHeight IsChecked = (InputManager.Instance.CurrentMotionState
= InputManager.Instance & MotionState.JUMP_PREPARE) != 0;
.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;
downCount++;
yield return false;
}
if (downCount >= 10)
Activated = true;
yield break;
} }
public override bool FinalJudgeAction() public override bool FinalJudgeAction()
{ {
float currentSpineHeight return (InputManager.Instance.CurrentMotionState
= InputManager.Instance & MotionState.JUMP_DONE) != 0;
.Joints[Windows.Kinect.JointType.SpineBase].Position.Y;
return currentSpineHeight >= spineHeight;
} }
} }
using System;
using System.Collections;
using UnityEngine;
public class OnTheTable : MotionNote
{
private static Sprite image = LoadNewSprite("Assets/MotionNotes/JP.png");
public override Sprite Image
{
get
{
return image;
}
}
public OnTheTable(string key, float timing) : this(timing)
{
}
public OnTheTable(float timing) : base(timing)
{
}
public override void Checkpoint()
{
IsChecked = true;
}
public override bool FinalJudgeAction()
{
return (InputManager.Instance.CurrentMotionState
& MotionState.ON_THE_TABLE) != 0;
}
}
fileFormatVersion: 2
guid: 03af2790100c5024185b0a02a2c81490
timeCreated: 1503640053
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -7,7 +7,9 @@ public class PushUp : MotionNote ...@@ -7,7 +7,9 @@ public class PushUp : MotionNote
enum Hand { Both, Left, Right } enum Hand { Both, Left, Right }
Hand hand; Hand hand;
private static Sprite image = LoadNewSprite(""); MotionState prepare, done;
private static Sprite image;
public override Sprite Image public override Sprite Image
{ {
get get
...@@ -22,12 +24,21 @@ public class PushUp : MotionNote ...@@ -22,12 +24,21 @@ public class PushUp : MotionNote
{ {
case "BP": case "BP":
hand = Hand.Both; hand = Hand.Both;
image = LoadNewSprite("BP");
prepare = MotionState.HAND_MOVE_UP_LEFT | MotionState.HAND_MOVE_UP_RIGHT;
done = MotionState.HAND_MOVE_DOWN_LEFT | MotionState.HAND_MOVE_DOWN_RIGHT;
break; break;
case "LP": case "LP":
hand = Hand.Left; hand = Hand.Left;
image = LoadNewSprite("LP");
prepare = MotionState.HAND_MOVE_UP_LEFT;
done = MotionState.HAND_MOVE_DOWN_LEFT;
break; break;
case "RP": case "RP":
hand = Hand.Right; hand = Hand.Right;
image = LoadNewSprite("RP");
prepare = MotionState.HAND_MOVE_UP_RIGHT;
done = MotionState.HAND_MOVE_DOWN_RIGHT;
break; break;
} }
} }
...@@ -35,21 +46,15 @@ public class PushUp : MotionNote ...@@ -35,21 +46,15 @@ public class PushUp : MotionNote
{ {
} }
public override IEnumerator Checkpoint() public override void Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; IsChecked = (InputManager.Instance.CurrentMotionState
var motion = motionState; & prepare) != 0;
while (motion != MotionState.CLAP_PREPARE)
yield return false;
Activated = true;
yield break;
} }
public override bool FinalJudgeAction() public override bool FinalJudgeAction()
{ {
throw new NotImplementedException(); return (InputManager.Instance.CurrentMotionState
& done) != 0;
} }
} }
...@@ -13,7 +13,7 @@ public abstract class MotionNote : Note ...@@ -13,7 +13,7 @@ public abstract class MotionNote : Note
public MotionNote(string key, float start, float end = 0f) public MotionNote(string key, float start, float end = 0f)
: this(start, end) { } : this(start, end) { }
public abstract IEnumerator Checkpoint(); public abstract void Checkpoint();
public abstract bool FinalJudgeAction(); public abstract bool FinalJudgeAction();
public bool IsChecked { get; protected set; } public bool IsChecked { get; protected set; }
...@@ -35,34 +35,26 @@ public abstract class MotionNote : Note ...@@ -35,34 +35,26 @@ public abstract class MotionNote : Note
{ "LK", typeof(PushUp) }, { "LK", typeof(PushUp) },
{ "RK", typeof(PushUp) }, { "RK", typeof(PushUp) },
{ "BI", typeof(Piano) },
{ "LI", typeof(Piano) },
{ "RI", typeof(Piano) },
{ "BG", typeof(Guard) }, { "BG", typeof(Guard) },
{ "LG", typeof(Guard) }, { "LG", typeof(Guard) },
{ "RG", typeof(Guard) }, { "RG", typeof(Guard) },
{ "BL", typeof(Guard) },
{ "LL", typeof(Guard) },
{ "RL", typeof(Guard) },
// Long motion // Long motion
{ "BU", typeof(Guard) }, { "BU", typeof(HandUp) },
{ "LU", typeof(Guard) }, { "LU", typeof(HandUp) },
{ "RU", typeof(Guard) }, { "RU", typeof(HandUp) },
{ "BD", typeof(Guard) }, { "BD", typeof(HandDown) },
{ "LD", typeof(Guard) }, { "LD", typeof(HandDown) },
{ "RD", typeof(Guard) }, { "RD", typeof(HandDown) },
{ "JS", typeof(Guard) }, { "JS", typeof(Jesus) },
{ "BH", typeof(Guard) }, { "BH", typeof(Headphone) },
{ "LH", typeof(Guard) }, { "LH", typeof(Headphone) },
{ "RH", typeof(Guard) }, { "RH", typeof(Headphone) },
{ "OT", typeof(Guard) }, { "OT", typeof(OnTheTable) },
}; };
protected static Sprite LoadNewSprite(string FilePath, float PixelsPerUnit = 100.0f) protected static Sprite LoadNewSprite(string FilePath, float PixelsPerUnit = 100.0f)
......
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