Commit c471ce93 authored by 16서원빈's avatar 16서원빈

Working on motion notes

parent 38fb1af7
using System; using System;
using System.Collections.Generic; using System.Collections;
using UnityEngine; using UnityEngine;
public class Clap : MotionNote public class Clap : MotionNote
...@@ -20,13 +20,13 @@ public class Clap : MotionNote ...@@ -20,13 +20,13 @@ public class Clap : MotionNote
{ {
} }
public override IEnumerable<bool> Checkpoint() public override IEnumerator Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; var motionState = InputManager.Instance.CurrentMotionState;
var motion = motionState; var motion = motionState;
while (motion != MotionState.CLAP_PREPARE) while (motion != MotionState.CLAP_PREPARE)
yield return false; yield return null;
Activated = true; Activated = true;
......
using System; using System;
using System.Collections.Generic; using System.Collections;
using UnityEngine; using UnityEngine;
public class Guard : MotionNote public class Guard : MotionNote
...@@ -16,7 +16,7 @@ public class Guard : MotionNote ...@@ -16,7 +16,7 @@ public class Guard : MotionNote
} }
} }
public Guard(string key, float timing) : this(timing) public Guard(string key, float timing, float end = 0f) : this(timing, end)
{ {
switch (key) switch (key)
{ {
...@@ -31,11 +31,11 @@ public class Guard : MotionNote ...@@ -31,11 +31,11 @@ public class Guard : MotionNote
break; break;
} }
} }
public Guard(float timing) : base(timing) public Guard(float timing, float end = 0f) : base(timing, end)
{ {
} }
public override IEnumerable<bool> Checkpoint() public override IEnumerator Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; var motionState = InputManager.Instance.CurrentMotionState;
var motion = motionState; var motion = motionState;
......
using System; using System;
using System.Collections.Generic; using System.Collections;
using UnityEngine; using UnityEngine;
public class Jump : MotionNote public class Jump : MotionNote
...@@ -20,7 +20,7 @@ public class Jump : MotionNote ...@@ -20,7 +20,7 @@ public class Jump : MotionNote
{ {
} }
public override IEnumerable<bool> Checkpoint() public override IEnumerator Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; var motionState = InputManager.Instance.CurrentMotionState;
var motion = motionState; var motion = motionState;
......
using System; using System;
using System.Collections.Generic; using System.Collections;
using UnityEngine; using UnityEngine;
public class Piano : MotionNote public class Piano : MotionNote
...@@ -35,7 +35,7 @@ public class Piano : MotionNote ...@@ -35,7 +35,7 @@ public class Piano : MotionNote
{ {
} }
public override IEnumerable<bool> Checkpoint() public override IEnumerator Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; var motionState = InputManager.Instance.CurrentMotionState;
var motion = motionState; var motion = motionState;
......
using System; using System;
using System.Collections.Generic; using System.Collections;
using UnityEngine; using UnityEngine;
public class PushUp : MotionNote public class PushUp : MotionNote
...@@ -35,7 +35,7 @@ public class PushUp : MotionNote ...@@ -35,7 +35,7 @@ public class PushUp : MotionNote
{ {
} }
public override IEnumerable<bool> Checkpoint() public override IEnumerator Checkpoint()
{ {
var motionState = InputManager.Instance.CurrentMotionState; var motionState = InputManager.Instance.CurrentMotionState;
var motion = motionState; var motion = motionState;
......
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using UnityEngine; using UnityEngine;
...@@ -12,28 +13,61 @@ public abstract class MotionNote : Note ...@@ -12,28 +13,61 @@ 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 IEnumerable<bool> Checkpoint(); public abstract IEnumerator Checkpoint();
public static readonly Dictionary<string, Type> keymap public static readonly Dictionary<string, Type> keymap
= new Dictionary<string, Type> = new Dictionary<string, Type>
{ {
{ "CP", typeof(Clap) }, { "CP", typeof(Clap) },
{ "JP", typeof(Jump) }, { "JP", typeof(Jump) },
{ "BP", typeof(PushUp) }, { "BP", typeof(PushUp) },
{ "LP", typeof(PushUp) }, { "LP", typeof(PushUp) },
{ "RP", typeof(PushUp) }, { "RP", typeof(PushUp) },
{ "BK", typeof(PushUp) },
{ "LK", typeof(PushUp) },
{ "RK", typeof(PushUp) },
{ "BI", typeof(Piano) }, { "BI", typeof(Piano) },
{ "LI", typeof(Piano) }, { "LI", typeof(Piano) },
{ "RI", 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
{ "BU", typeof(Guard) },
{ "LU", typeof(Guard) },
{ "RU", typeof(Guard) },
{ "BD", typeof(Guard) },
{ "LD", typeof(Guard) },
{ "RD", typeof(Guard) },
{ "JS", typeof(Guard) },
{ "BH", typeof(Guard) },
{ "LH", typeof(Guard) },
{ "RH", typeof(Guard) },
{ "OT", typeof(Guard) },
}; };
protected static Sprite LoadNewSprite(string FilePath, float PixelsPerUnit = 100.0f) protected static Sprite LoadNewSprite(string FilePath, float PixelsPerUnit = 100.0f)
{ {
Sprite NewSprite = new Sprite(); Sprite NewSprite = new Sprite();
Texture2D SpriteTexture = LoadTexture(FilePath); Texture2D SpriteTexture = LoadTexture(FilePath);
if (SpriteTexture == null)
return null;
NewSprite = Sprite.Create(SpriteTexture, NewSprite = Sprite.Create(SpriteTexture,
new Rect(0, 0, SpriteTexture.width, SpriteTexture.height), new Rect(0, 0, SpriteTexture.width, SpriteTexture.height),
new Vector2(0, 0), PixelsPerUnit); new Vector2(0, 0), PixelsPerUnit);
......
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