Commit 16e4f7a8 authored by 16이상민's avatar 16이상민

Fixed a problem where the sprite of the motion note does not appear on the screen.

parent d2408a2c
...@@ -13,7 +13,6 @@ namespace JudgeModule ...@@ -13,7 +13,6 @@ namespace JudgeModule
private float interval; private float interval;
private GameObject sample, private GameObject sample,
appear; appear;
private MotionSampleDisplay sampleDisplay;
public JudgeManager(InputManager input, public JudgeManager(InputManager input,
Action endgame, Action endgame,
...@@ -26,7 +25,6 @@ namespace JudgeModule ...@@ -26,7 +25,6 @@ namespace JudgeModule
appear = objects["appear"]; appear = objects["appear"];
sample = objects["sample"]; sample = objects["sample"];
sampleDisplay = sample.GetComponent<MotionSampleDisplay>();
sample.SetActive(false); sample.SetActive(false);
} }
...@@ -76,11 +74,13 @@ namespace JudgeModule ...@@ -76,11 +74,13 @@ namespace JudgeModule
{ {
note.SamplePlayed = true; note.SamplePlayed = true;
sample.SetActive(false); var obj = UnityEngine.Object.Instantiate(sample);
sample.SetActive(true);
var sampleDisplay = obj.GetComponent<MotionSampleDisplay>();
obj.SetActive(false);
sampleDisplay.sprite = note.Image; sampleDisplay.sprite = note.Image;
sampleDisplay.timeout = interval; sampleDisplay.timeout = interval;
obj.SetActive(true);
} }
} }
} }
......
...@@ -125,9 +125,7 @@ namespace JudgeModule ...@@ -125,9 +125,7 @@ namespace JudgeModule
{ {
var controllers = enables[name].ToArray(); var controllers = enables[name].ToArray();
foreach (var c in controllers) foreach (var c in controllers)
if (initialPos.x - c.transform.position.x if (initialPos.x - c.EndPosition(ScrollSpeed) > Judge.BAD.TimingRange(c.Instance))
- (c.Instance.EndTiming - c.Instance.StartTiming)
> Judge.BAD.TimingRange(c.Instance))
{ {
NoteJudger.SetJudge(Judge.MISS, judgetext); NoteJudger.SetJudge(Judge.MISS, judgetext);
c.Deactivate(deactives.transform); c.Deactivate(deactives.transform);
...@@ -141,7 +139,7 @@ namespace JudgeModule ...@@ -141,7 +139,7 @@ namespace JudgeModule
{ {
var controllers = disables[name].ToArray(); var controllers = disables[name].ToArray();
foreach (var c in controllers) foreach (var c in controllers)
if (c.transform.position.x <= disappear.transform.position.x) if (c.EndPosition(ScrollSpeed) <= disappear.transform.position.x)
{ {
c.transform.position = appear.transform.position; c.transform.position = appear.transform.position;
c.transform.SetParent(appear.transform); c.transform.SetParent(appear.transform);
......
using UnityEngine; using UnityEngine;
using System.Collections.Generic;
public class Guard : MotionNote public class Guard : MotionNote
{ {
private static Sprite image; private static Dictionary<string, Sprite> image =
new Dictionary<string, Sprite>
{
{ "GuardBoth", LoadNewSprite("Assets/MotionNotes/BG.png") },
{ "GuardLeft", LoadNewSprite("Assets/MotionNotes/LG.png") },
{ "GuardRight", LoadNewSprite("Assets/MotionNotes/RG.png") }
};
public override Sprite Image public override Sprite Image
{ {
get get
{ {
return image; return image[MotionName];
} }
} }
...@@ -17,15 +24,12 @@ public class Guard : MotionNote ...@@ -17,15 +24,12 @@ public class Guard : MotionNote
switch (key) switch (key)
{ {
case "BG": case "BG":
image = LoadNewSprite("Assets/MotionNotes/BG.png");
MotionName = "GuardBoth"; MotionName = "GuardBoth";
break; break;
case "LG": case "LG":
image = LoadNewSprite("Assets/MotionNotes/LG.png");
MotionName = "GuardLeft"; MotionName = "GuardLeft";
break; break;
case "RG": case "RG":
image = LoadNewSprite("Assets/MotionNotes/RG.png");
MotionName = "GuardRight"; MotionName = "GuardRight";
break; break;
} }
......
using UnityEngine; using System.Collections.Generic;
using UnityEngine;
public class HandDown : MotionNote public class HandDown : MotionNote
{ {
private static Sprite image; private static Dictionary<string, Sprite> image =
new Dictionary<string, Sprite>
{
{ "HandDownBoth", LoadNewSprite("Assets/MotionNotes/BD.png") },
{ "HandDownLeft", LoadNewSprite("Assets/MotionNotes/LD.png") },
{ "HandDownRight", LoadNewSprite("Assets/MotionNotes/RD.png") }
};
public override Sprite Image public override Sprite Image
{ {
get get
{ {
return image; return image[MotionName];
} }
} }
...@@ -17,15 +24,12 @@ public class HandDown : MotionNote ...@@ -17,15 +24,12 @@ public class HandDown : MotionNote
switch (key) switch (key)
{ {
case "BD": case "BD":
image = LoadNewSprite("Assets/MotionNotes/BD.png");
MotionName = "HandDownBoth"; MotionName = "HandDownBoth";
break; break;
case "LD": case "LD":
image = LoadNewSprite("Assets/MotionNotes/LD.png");
MotionName = "HandDownLeft"; MotionName = "HandDownLeft";
break; break;
case "RD": case "RD":
image = LoadNewSprite("Assets/MotionNotes/RD.png");
MotionName = "HandDownRight"; MotionName = "HandDownRight";
break; break;
} }
......
using UnityEngine; using System.Collections.Generic;
using UnityEngine;
public class HandUp : MotionNote public class HandUp : MotionNote
{ {
private static Sprite image; private static Dictionary<string, Sprite> image =
new Dictionary<string, Sprite>
{
{ "HandUpBoth", LoadNewSprite("Assets/MotionNotes/BU.png") },
{ "HandUpLeft", LoadNewSprite("Assets/MotionNotes/LU.png") },
{ "HandUpRight", LoadNewSprite("Assets/MotionNotes/RU.png") }
};
public override Sprite Image public override Sprite Image
{ {
get get
{ {
return image; return image[MotionName];
} }
} }
...@@ -17,15 +24,12 @@ public class HandUp : MotionNote ...@@ -17,15 +24,12 @@ public class HandUp : MotionNote
switch (key) switch (key)
{ {
case "BU": case "BU":
image = LoadNewSprite("Assets/MotionNotes/BU.png");
MotionName = "HandUpBoth"; MotionName = "HandUpBoth";
break; break;
case "LU": case "LU":
image = LoadNewSprite("Assets/MotionNotes/LU.png");
MotionName = "HandUpLeft"; MotionName = "HandUpLeft";
break; break;
case "RU": case "RU":
image = LoadNewSprite("Assets/MotionNotes/RU.png");
MotionName = "HandUpRight"; MotionName = "HandUpRight";
break; break;
} }
......
using UnityEngine; using System.Collections.Generic;
using UnityEngine;
public class Headphone : MotionNote public class Headphone : MotionNote
{ {
private static Sprite image; private static Dictionary<string, Sprite> image =
new Dictionary<string, Sprite>
{
{ "HeadphoneBoth", LoadNewSprite("Assets/MotionNotes/BH.png") },
{ "HeadphoneLeft", LoadNewSprite("Assets/MotionNotes/LH.png") },
{ "HeadphoneRight", LoadNewSprite("Assets/MotionNotes/RH.png") }
};
public override Sprite Image public override Sprite Image
{ {
get get
{ {
return image; return image[MotionName];
} }
} }
...@@ -17,15 +24,12 @@ public class Headphone : MotionNote ...@@ -17,15 +24,12 @@ public class Headphone : MotionNote
switch (key) switch (key)
{ {
case "BH": case "BH":
image = LoadNewSprite("Assets/MotionNotes/BH.png");
MotionName = "HeadphoneBoth"; MotionName = "HeadphoneBoth";
break; break;
case "LH": case "LH":
image = LoadNewSprite("Assets/MotionNotes/LH.png");
MotionName = "HeadphoneLeft"; MotionName = "HeadphoneLeft";
break; break;
case "RH": case "RH":
image = LoadNewSprite("Assets/MotionNotes/RH.png");
MotionName = "HeadphoneRight"; MotionName = "HeadphoneRight";
break; break;
} }
......
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class PushUp : MotionNote public class PushUp : MotionNote
{ {
private static Sprite image; private static Dictionary<string, Sprite> image =
new Dictionary<string, Sprite>
{
{ "PushUpBoth", LoadNewSprite("Assets/MotionNotes/BP.png") },
{ "PushUpLeft", LoadNewSprite("Assets/MotionNotes/LP.png") },
{ "PushUpRight", LoadNewSprite("Assets/MotionNotes/RP.png") },
{ "JumpPushUpBoth", LoadNewSprite("Assets/MotionNotes/BK.png") },
{ "JumpPushUpLeft", LoadNewSprite("Assets/MotionNotes/LK.png") },
{ "JumpPushUpRight", LoadNewSprite("Assets/MotionNotes/RK.png") }
};
public override Sprite Image public override Sprite Image
{ {
get get
{ {
return image; return image[MotionName];
} }
} }
...@@ -17,27 +27,21 @@ public class PushUp : MotionNote ...@@ -17,27 +27,21 @@ public class PushUp : MotionNote
switch (key) switch (key)
{ {
case "BP": case "BP":
image = LoadNewSprite("Assets/MotionNotes/BP.png");
MotionName = "PushUpBoth"; MotionName = "PushUpBoth";
break; break;
case "LP": case "LP":
image = LoadNewSprite("Assets/MotionNotes/LP.png");
MotionName = "PushUpLeft"; MotionName = "PushUpLeft";
break; break;
case "RP": case "RP":
image = LoadNewSprite("Assets/MotionNotes/RP.png");
MotionName = "PushUpRight"; MotionName = "PushUpRight";
break; break;
case "BK": case "BK":
image = LoadNewSprite("Assets/MotionNotes/BK.png");
MotionName = "JumpPushUpBoth"; MotionName = "JumpPushUpBoth";
break; break;
case "LK": case "LK":
image = LoadNewSprite("Assets/MotionNotes/LK.png");
MotionName = "JumpPushUpLeft"; MotionName = "JumpPushUpLeft";
break; break;
case "RK": case "RK":
image = LoadNewSprite("Assets/MotionNotes/RK.png");
MotionName = "JumpPushUpRight"; MotionName = "JumpPushUpRight";
break; break;
} }
......
...@@ -42,7 +42,7 @@ GameObject: ...@@ -42,7 +42,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!1 &1892747765238962 --- !u!1 &1892747765238962
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -124,6 +124,7 @@ SpriteRenderer: ...@@ -124,6 +124,7 @@ SpriteRenderer:
m_Enabled: 1 m_Enabled: 1
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 1 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
...@@ -139,6 +140,7 @@ SpriteRenderer: ...@@ -139,6 +140,7 @@ SpriteRenderer:
m_PreserveUVs: 0 m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0 m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0 m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0 m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4 m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
...@@ -166,6 +168,7 @@ SpriteRenderer: ...@@ -166,6 +168,7 @@ SpriteRenderer:
m_Enabled: 1 m_Enabled: 1
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 1 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
...@@ -181,6 +184,7 @@ SpriteRenderer: ...@@ -181,6 +184,7 @@ SpriteRenderer:
m_PreserveUVs: 0 m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0 m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0 m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0 m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4 m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
......
...@@ -867,6 +867,11 @@ Prefab: ...@@ -867,6 +867,11 @@ Prefab:
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 7 value: 7
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 114320804396245296, guid: 643501fb5118b2e4b94934b03e205885,
type: 2}
propertyPath: timeout
value: 1000
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 643501fb5118b2e4b94934b03e205885, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 643501fb5118b2e4b94934b03e205885, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
......
...@@ -47,4 +47,10 @@ public class Controller : MonoBehaviour ...@@ -47,4 +47,10 @@ public class Controller : MonoBehaviour
disables.Add(this); disables.Add(this);
enables.Remove(this); enables.Remove(this);
} }
public float EndPosition(float ScrollSpeed)
{
return transform.position.x +
(Instance.EndTiming - Instance.StartTiming) * ScrollSpeed;
}
} }
\ No newline at end of file
...@@ -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/test2.bpe"); = new TrackInfo("Assets/Tracks/Tutorial/temp2.bpe");
} }
return instance; return instance;
......
...@@ -84,7 +84,7 @@ public class InGameManager : MonoBehaviour ...@@ -84,7 +84,7 @@ public class InGameManager : MonoBehaviour
{ "appear", appear }, { "appear", appear },
{ "disappear", disappear }, { "disappear", disappear },
{ "judgetext", judgetext }, { "judgetext", judgetext },
{ "sample", Instantiate(motionSampleDisplayPrefab) } { "sample", motionSampleDisplayPrefab }
}); });
} }
......
...@@ -20,7 +20,7 @@ public class JudgeTextManager : MonoBehaviour ...@@ -20,7 +20,7 @@ public class JudgeTextManager : MonoBehaviour
// Update is called once per frame // Update is called once per frame
private void Update () private void Update ()
{ {
if (Time.time - start > 1) if (Time.time - start > 0.5)
gameObject.SetActive(false); gameObject.SetActive(false);
} }
} }
...@@ -14,39 +14,36 @@ public class MotionSampleDisplay : MonoBehaviour ...@@ -14,39 +14,36 @@ public class MotionSampleDisplay : MonoBehaviour
private float acceleration; private float acceleration;
private float distance = 1.5f, private float distance = 1.5f;
last = 0;
private Vector3 localScaleLR = new Vector3(0.5f, 0.5f, 0), private Vector3 localScaleLR = new Vector3(0.5f, 0.5f, 0),
initialPosL, initialPos;
initialPosR;
private void Start() private void Start()
{ {
initialPosL = left .transform.position; var obj = GameObject.Find("CoordinateMapView").transform;
initialPosR = right.transform.position; initialPos = obj.position;
transform.position = initialPos;
transform.SetParent(obj);
left .transform.position = initialPos;
right.transform.position = initialPos;
} }
private void OnEnable() private void OnEnable()
{ {
acceleration = 2 * distance / Mathf.Pow(timeout, 2); acceleration = 2 * distance / Mathf.Pow(timeout, 2);
last = 0;
isInit = false; isInit = false;
SetObject(left, initialPosL, true);
SetObject(right, initialPosR, false);
}
void SetObject(GameObject obj, Vector3 initialPos, bool isLeft) left .GetComponent<SpriteRenderer>().sprite = sprite;
{ right.GetComponent<SpriteRenderer>().sprite = sprite;
obj.GetComponent<SpriteRenderer>().sprite = sprite; left .transform.localScale = localScaleLR;
obj.transform.position = initialPos; right.transform.localScale = localScaleLR;
obj.transform.Translate(new Vector3(distance * (isLeft ? -1 : 1), -0.8f, 0)); left .transform.position = initialPos + Vector3.left * distance;
obj.transform.localScale = localScaleLR; right.transform.position = initialPos + Vector3.right * distance;
} }
private void Update() private void Update()
{ {
var current = Time.time; var current = Time.time * 1000;
if (!isInit) if (!isInit)
{ {
isInit = true; isInit = true;
...@@ -56,14 +53,12 @@ public class MotionSampleDisplay : MonoBehaviour ...@@ -56,14 +53,12 @@ public class MotionSampleDisplay : MonoBehaviour
var delta = current - start; var delta = current - start;
if (delta > timeout) if (delta > timeout)
{ {
gameObject.SetActive(false); Destroy(gameObject);
return; return;
} }
var movement = acceleration / 2 * (Mathf.Pow(delta, 2) - Mathf.Pow(last, 2)); var location = distance - acceleration / 2 * Mathf.Pow(delta, 2);
left .transform.Translate(new Vector3(movement, 0, 0)); left .transform.position = initialPos + Vector3.left * location;
right.transform.Translate(new Vector3(-movement, 0, 0)); right.transform.position = initialPos + Vector3.right * location;
last = delta;
} }
} }
\ No newline at end of file
#TITLE test2
#ARTIST asdf
#GENRE asdf
#BPM 120
#PLAYLEVEL 0
#000SMO 000000CP
#001LMO 000000JS
#002LMO 000000JS
#003SMO 000000CP
#004LMO 000000JS
#005LMO 000000JS
#006SMO 000000CP
#007LMO 000000JS
#008LMO 000000JS
\ No newline at end of file
fileFormatVersion: 2
guid: d37c512d9182dd445855e4095f1ca842
timeCreated: 1519305858
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
#TITLE test
#ARTIST asdf
#GENRE asdf
#BPM 120
#PLAYLEVEL 0
#000SMO 00CP00CP
#001SMO 00CP00CP
#002SMO 00CP00CP
#003SMO 00CP00CP
#004SMO 00CP00CP
#005SMO 00CP00CP
#006SMO 00CP00CP
#007SMO 00CP00CP
#008SMO 00CP00CP
\ No newline at end of file
fileFormatVersion: 2
guid: 8b1ee7ffd4fa3524281a7262ec36ccee
timeCreated: 1519289427
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
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