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

모션노트 완료

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