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

Add Beat/Measure lines logic

parent 5d59739a
......@@ -27,7 +27,13 @@ namespace JudgeModule
disables
= new Dictionary<string, List<Controller>>();
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
{
......@@ -131,6 +137,7 @@ namespace JudgeModule
DeactiveUndecided();
SwitchStandBy();
AssignNotes(timing);
AssignLines(timing);
}
private void DeactiveUndecided()
......@@ -149,7 +156,7 @@ namespace JudgeModule
private void SwitchStandBy()
{
foreach (var name in notenames)
foreach (var name in names)
{
var controllers = disables[name].ToArray();
foreach (var c in controllers)
......@@ -162,7 +169,10 @@ namespace JudgeModule
c.gameObject.SetActive(false);
disables[name].Remove(c);
waits[name].Add(c);
++cntWait;
if (name != "BeatLine" &&
name != "MeasureLine")
++cntWait;
}
}
}
......@@ -246,5 +256,43 @@ namespace JudgeModule
hold.Translate(Vector3.right * (length / 2));
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:
m_Name:
m_EditorClassIdentifier:
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_OnCullStateChanged:
m_PersistentCalls:
......@@ -77,5 +77,5 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 1}
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}
......@@ -40,7 +40,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
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_OnCullStateChanged:
m_PersistentCalls:
......
......@@ -9,8 +9,6 @@ public class Controller : MonoBehaviour
public List<Controller> enables,
disables;
private float time = 0f;
private readonly float minAlpha = 0.3f;
private readonly float maxAlpha = 0.7f;
......@@ -19,15 +17,11 @@ public class Controller : MonoBehaviour
{
if (transform.parent.gameObject.name == "Deactives")
{
time += Time.deltaTime * 3;
foreach (Image img in GetComponentsInChildren<Image>())
{
Color tmp = img.color;
tmp.a = 0f;
img.color = tmp + new Color(0, 0, 0,
(maxAlpha + minAlpha) / 2
+ Mathf.Cos(time * 4) * (maxAlpha - minAlpha) / 2);
img.color = tmp + new Color(0, 0, 0, minAlpha);
}
}
}
......
......@@ -4,17 +4,17 @@ using Windows.Kinect;
public class CoordinateMapperManager : MonoBehaviour
{
private DepthSpacePoint[] _DepthCoordinates;
private DepthSpacePoint[] _DepthCoordinates;
private KinectModule.SourceBuffer _SourceBuffer;
private KinectModule.KinectAccessManager _KinectAccessManager;
long frameCount = 0;
long frameCount = 0;
double elapsedCounter = 0.0;
double fps = 0.0;
Texture2D _ColorRGBX;
double elapsedCounter = 0.0;
double fps = 0.0;
Texture2D _ColorRGBX;
public Texture2D ColorTexture
{ get { return _ColorRGBX; } }
......@@ -26,12 +26,12 @@ public class CoordinateMapperManager : MonoBehaviour
{ get { return _SourceBuffer.BodyBuffer; } }
void Awake()
{
{
_ColorRGBX = new Texture2D (KinectModule.KinectConstants.ColorWidth,
KinectModule.KinectConstants.ColorHeight,
TextureFormat.RGBA32, false);
_DepthCoordinates = new DepthSpacePoint[KinectModule.KinectConstants.ColorWidth *
_DepthCoordinates = new DepthSpacePoint[KinectModule.KinectConstants.ColorWidth *
KinectModule.KinectConstants.ColorHeight];
_SourceBuffer = new KinectModule.SourceBuffer();
......@@ -51,12 +51,12 @@ public class CoordinateMapperManager : MonoBehaviour
}
void OnGUI ()
{
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)
GUI.Box (new Rect(10, 50, 200, 30), "NULL MSFR Frame");
}
/*if (_KinectAccessManager.NullFrame)
GUI.Box (new Rect(10, 50, 200, 30), "NULL MSFR Frame");*/
}
void MapColorToDepth()
{
......@@ -90,12 +90,12 @@ public class CoordinateMapperManager : MonoBehaviour
}
frameCount++;
}
void Update()
{
void Update()
{
GetFPS();
var sourceFrame = new KinectModule.RealMultiSourceFrame(_KinectAccessManager.SourceFrame);
var sourceFrame = new KinectModule.RealMultiSourceFrame(_KinectAccessManager.SourceFrame);
if (!_KinectAccessManager.NullFrame)
{
......@@ -105,10 +105,10 @@ public class CoordinateMapperManager : MonoBehaviour
UpdateTexture();
}
}
}
void OnApplicationQuit()
{
void OnApplicationQuit()
{
_KinectAccessManager.Dispose();
}
}
}
......@@ -16,7 +16,7 @@ public class GameManager : MonoBehaviour {
instance = new GameObject().AddComponent<GameManager>();
instance.CurrentTrack
= new TrackInfo("Assets/Tracks/Tutorial/temp2.bpe");
= new TrackInfo("Assets/Tracks/Tutorial/temp.bpe");
}
return instance;
......
......@@ -16,3 +16,5 @@ PhysicsManager:
m_EnableAdaptiveForce: 0
m_EnablePCM: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 1
......@@ -19,10 +19,12 @@ Physics2DSettings:
m_LinearSleepTolerance: 0.01
m_AngularSleepTolerance: 2
m_DefaultContactOffset: 0.01
m_AutoSimulation: 1
m_QueriesHitTriggers: 1
m_QueriesStartInColliders: 1
m_ChangeStopsCallbacks: 0
m_CallbacksOnDisable: 1
m_AutoSyncTransforms: 1
m_AlwaysShowColliders: 0
m_ShowColliderSleep: 1
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