Commit 0868bc71 authored by 16이상민's avatar 16이상민

Add Beat/Measure lines logic

parent 5d59739a
...@@ -27,7 +27,13 @@ namespace JudgeModule ...@@ -27,7 +27,13 @@ namespace JudgeModule
disables disables
= new Dictionary<string, List<Controller>>(); = new Dictionary<string, List<Controller>>();
private string[] notenames private string[] notenames
= new string[] { "SBT", "LBT", "SMO", "LMO" }; = new string[] { "SBT", "LBT", "SMO", "LMO" },
linenames
= new string[] { "BeatLine", "MeasureLine" },
names
= new string[] { "SBT", "LBT", "SMO", "LMO", "BeatLine", "MeasureLine" };
private float recentBeatTiming,
recentMeasureTiming;
public Note CurrentBT public Note CurrentBT
{ {
...@@ -131,6 +137,7 @@ namespace JudgeModule ...@@ -131,6 +137,7 @@ namespace JudgeModule
DeactiveUndecided(); DeactiveUndecided();
SwitchStandBy(); SwitchStandBy();
AssignNotes(timing); AssignNotes(timing);
AssignLines(timing);
} }
private void DeactiveUndecided() private void DeactiveUndecided()
...@@ -149,7 +156,7 @@ namespace JudgeModule ...@@ -149,7 +156,7 @@ namespace JudgeModule
private void SwitchStandBy() private void SwitchStandBy()
{ {
foreach (var name in notenames) foreach (var name in names)
{ {
var controllers = disables[name].ToArray(); var controllers = disables[name].ToArray();
foreach (var c in controllers) foreach (var c in controllers)
...@@ -162,6 +169,9 @@ namespace JudgeModule ...@@ -162,6 +169,9 @@ namespace JudgeModule
c.gameObject.SetActive(false); c.gameObject.SetActive(false);
disables[name].Remove(c); disables[name].Remove(c);
waits[name].Add(c); waits[name].Add(c);
if (name != "BeatLine" &&
name != "MeasureLine")
++cntWait; ++cntWait;
} }
} }
...@@ -246,5 +256,43 @@ namespace JudgeModule ...@@ -246,5 +256,43 @@ namespace JudgeModule
hold.Translate(Vector3.right * (length / 2)); hold.Translate(Vector3.right * (length / 2));
end .Translate(Vector3.right * length); end .Translate(Vector3.right * length);
} }
private void AssignLines(float timing)
{
foreach (var name in linenames)
{
foreach (var x in waits[name])
AssignLine(name, timing, x);
disables[name].AddRange(waits[name]);
waits[name].Clear();
}
}
private void AssignLine(string name, float timing, Controller controller)
{
NoteType type = (NoteType)Enum.Parse(typeof(NoteType), name);
float next;
if (type == NoteType.BeatLine)
{
next = recentBeatTiming;
recentBeatTiming += (MsPerBeat / 4);
}
else
{
next = recentMeasureTiming;
recentMeasureTiming += MsPerBeat;
}
Note note = new Note(type, next);
controller.Instance = note;
note.Component = controller;
controller.transform.position = initialPos +
Vector3.right * ((note.StartTiming - timing) * ScrollSpeed);
controller.transform.SetParent(deactives.transform);
controller.gameObject.SetActive(true);
}
} }
} }
\ No newline at end of file
...@@ -40,7 +40,7 @@ MonoBehaviour: ...@@ -40,7 +40,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.627451} m_Color: {r: 0.5808823, g: 0.5808823, b: 0.5808823, a: 0.352}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
...@@ -77,5 +77,5 @@ RectTransform: ...@@ -77,5 +77,5 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0} m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 2, y: 0} m_SizeDelta: {x: 0.5, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
...@@ -40,7 +40,7 @@ MonoBehaviour: ...@@ -40,7 +40,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.627451} m_Color: {r: 0.5808823, g: 0.5808823, b: 0.5808823, a: 0.602}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
......
...@@ -9,8 +9,6 @@ public class Controller : MonoBehaviour ...@@ -9,8 +9,6 @@ public class Controller : MonoBehaviour
public List<Controller> enables, public List<Controller> enables,
disables; disables;
private float time = 0f;
private readonly float minAlpha = 0.3f; private readonly float minAlpha = 0.3f;
private readonly float maxAlpha = 0.7f; private readonly float maxAlpha = 0.7f;
...@@ -19,15 +17,11 @@ public class Controller : MonoBehaviour ...@@ -19,15 +17,11 @@ public class Controller : MonoBehaviour
{ {
if (transform.parent.gameObject.name == "Deactives") if (transform.parent.gameObject.name == "Deactives")
{ {
time += Time.deltaTime * 3;
foreach (Image img in GetComponentsInChildren<Image>()) foreach (Image img in GetComponentsInChildren<Image>())
{ {
Color tmp = img.color; Color tmp = img.color;
tmp.a = 0f; tmp.a = 0f;
img.color = tmp + new Color(0, 0, 0, img.color = tmp + new Color(0, 0, 0, minAlpha);
(maxAlpha + minAlpha) / 2
+ Mathf.Cos(time * 4) * (maxAlpha - minAlpha) / 2);
} }
} }
} }
......
...@@ -54,8 +54,8 @@ public class CoordinateMapperManager : MonoBehaviour ...@@ -54,8 +54,8 @@ public class CoordinateMapperManager : MonoBehaviour
{ {
GUI.Box (new Rect(10, 10, 200, 30), "FPS: " + fps.ToString("0.00")); GUI.Box (new Rect(10, 10, 200, 30), "FPS: " + fps.ToString("0.00"));
if (_KinectAccessManager.NullFrame) /*if (_KinectAccessManager.NullFrame)
GUI.Box (new Rect(10, 50, 200, 30), "NULL MSFR Frame"); GUI.Box (new Rect(10, 50, 200, 30), "NULL MSFR Frame");*/
} }
void MapColorToDepth() void MapColorToDepth()
......
...@@ -16,7 +16,7 @@ public class GameManager : MonoBehaviour { ...@@ -16,7 +16,7 @@ public class GameManager : MonoBehaviour {
instance = new GameObject().AddComponent<GameManager>(); instance = new GameObject().AddComponent<GameManager>();
instance.CurrentTrack instance.CurrentTrack
= new TrackInfo("Assets/Tracks/Tutorial/temp2.bpe"); = new TrackInfo("Assets/Tracks/Tutorial/temp.bpe");
} }
return instance; return instance;
......
...@@ -16,3 +16,5 @@ PhysicsManager: ...@@ -16,3 +16,5 @@ PhysicsManager:
m_EnableAdaptiveForce: 0 m_EnableAdaptiveForce: 0
m_EnablePCM: 1 m_EnablePCM: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 1
...@@ -19,10 +19,12 @@ Physics2DSettings: ...@@ -19,10 +19,12 @@ Physics2DSettings:
m_LinearSleepTolerance: 0.01 m_LinearSleepTolerance: 0.01
m_AngularSleepTolerance: 2 m_AngularSleepTolerance: 2
m_DefaultContactOffset: 0.01 m_DefaultContactOffset: 0.01
m_AutoSimulation: 1
m_QueriesHitTriggers: 1 m_QueriesHitTriggers: 1
m_QueriesStartInColliders: 1 m_QueriesStartInColliders: 1
m_ChangeStopsCallbacks: 0 m_ChangeStopsCallbacks: 0
m_CallbacksOnDisable: 1 m_CallbacksOnDisable: 1
m_AutoSyncTransforms: 1
m_AlwaysShowColliders: 0 m_AlwaysShowColliders: 0
m_ShowColliderSleep: 1 m_ShowColliderSleep: 1
m_ShowColliderContacts: 0 m_ShowColliderContacts: 0
......
m_EditorVersion: 2017.3.0f3 m_EditorVersion: 2017.2.0f3
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