Commit 9d2c6c23 authored by 16서원빈's avatar 16서원빈

Motion note WIP

parent da247e49
fileFormatVersion: 2
guid: 46b8c83e903c35247a37976840e26292
timeCreated: 1503598536
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Tizen
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: WebGL
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 969c52c8829bea04b9089430f30fc61c
timeCreated: 1503598650
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
......@@ -4,7 +4,7 @@ using UnityEngine;
public class Clap : MotionNote
{
private static Sprite image = LoadNewSprite("");
private static Sprite image = LoadNewSprite("Assets/MotionNotes/BU.png");
public override Sprite Image
{
get
......@@ -22,14 +22,23 @@ public class Clap : MotionNote
public override IEnumerator Checkpoint()
{
var motionState = InputManager.Instance.CurrentMotionState;
var motion = motionState;
var motion = InputManager.Instance.CurrentMotionState;
while (motion != MotionState.CLAP_PREPARE)
while ((motion & MotionState.CLAP_PREPARE) == 0)
yield return null;
Activated = true;
IsChecked = true;
yield break;
}
public override bool FinalJudgeAction()
{
var motion = InputManager.Instance.CurrentMotionState;
if ((motion & MotionState.CLAP_DONE) != 0)
return true;
return false;
}
}
......@@ -47,4 +47,9 @@ public class Guard : MotionNote
yield break;
}
public override bool FinalJudgeAction()
{
throw new NotImplementedException();
}
}
......@@ -32,4 +32,9 @@ public class Jump : MotionNote
yield break;
}
public override bool FinalJudgeAction()
{
throw new NotImplementedException();
}
}
......@@ -47,4 +47,9 @@ public class Piano : MotionNote
yield break;
}
public override bool FinalJudgeAction()
{
throw new NotImplementedException();
}
}
......@@ -47,4 +47,9 @@ public class PushUp : MotionNote
yield break;
}
public override bool FinalJudgeAction()
{
throw new NotImplementedException();
}
}
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1870857072681458}
m_IsPrefabParent: 1
--- !u!1 &1531738911155356
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4732774613406210}
- component: {fileID: 212869765336974258}
m_Layer: 0
m_Name: Right
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1870857072681458
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4171896903265876}
- component: {fileID: 114320804396245296}
m_Layer: 0
m_Name: Motion Sample Display
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1892747765238962
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4514239179313720}
- component: {fileID: 212350653360387852}
m_Layer: 0
m_Name: Left
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4171896903265876
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1870857072681458}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 5.5, z: -1.6}
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
m_Children:
- {fileID: 4514239179313720}
- {fileID: 4732774613406210}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4514239179313720
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1892747765238962}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4171896903265876}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4732774613406210
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1531738911155356}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4171896903265876}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114320804396245296
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1870857072681458}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f8f9b9cb79ad63439e419b9f27ad79b, type: 3}
m_Name:
m_EditorClassIdentifier:
left: {fileID: 1892747765238962}
right: {fileID: 1531738911155356}
sprite: {fileID: 0}
timeout: 0
--- !u!212 &212350653360387852
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1892747765238962}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
--- !u!212 &212869765336974258
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1531738911155356}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
fileFormatVersion: 2
guid: 643501fb5118b2e4b94934b03e205885
timeCreated: 1503593468
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
m_IndirectSpecularColor: {r: 0.37311918, g: 0.3807398, b: 0.35872716, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
......
......@@ -15,7 +15,7 @@ public class GameManager : MonoBehaviour {
as GameManager;
instance.CurrentTrack
= new TrackInfo("Assets/Tracks/Tutorial/tutorial1.bpe");
= new TrackInfo("Assets/Tracks/Test/Test.bpe");
}
return instance;
......
......@@ -22,12 +22,10 @@ public class InputManager : MonoBehaviour {
}
}
private KeyCode theButton = KeyCode.Space | KeyCode.Joystick1Button0;
private bool IsButtonDownPrev { get; set; }
private bool IsButtonDown
{
get { return Input.GetKey(theButton); }
get { return Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.Joystick1Button0); }
}
public MotionState CurrentMotionState { get; set; }
......
......@@ -29,10 +29,14 @@ public class JudgeManager : MonoBehaviour
private GameObject motionGuage;
private GameObject judgeText;
private GameObject motionSampleDisplayPrefab;
private Vector3 initialPos;
private float elapsedTime = 0;
private List<MotionNote> activatedNotes;
private float MsPerBeat
{
get
......@@ -59,10 +63,14 @@ public class JudgeManager : MonoBehaviour
judgeText = GameObject.Find("Judge");
motionGuage = GameObject.Find("Motion Guage");
motionSampleDisplayPrefab = Resources.Load("Motion Sample Display") as GameObject;
initialPos = offset.transform.position;
judgeText.SetActive(false);
motionGuage.transform.parent.gameObject.SetActive(false);
activatedNotes = new List<MotionNote>();
LoadNotes(GameManager.Instance.CurrentTrack.Notes);
}
......@@ -134,12 +142,25 @@ public class JudgeManager : MonoBehaviour
GameObject smo = smobj.transform.GetChild(0).gameObject;
MotionNote smnote = (MotionNote)smo.GetComponent<Note.Controller>().Instance;
smnote.Checkpoint();
if (!smnote.Activated && elapsedTime >= (smnote.StartTiming - MsPerBeat))
{
GameObject motionSample = Instantiate(motionSampleDisplayPrefab);
MotionSampleDisplay msd = motionSample.GetComponent<MotionSampleDisplay>();
msd.sprite = smnote.Image;
msd.timeout = MsPerBeat;
smnote.Activated = true;
smnote.MotionSampleDisplay = msd;
activatedNotes.Add(smnote);
}
if (smnote.Activated)
foreach (MotionNote note in activatedNotes)
{
SetJudge(Judge.TestJudge(smnote, timing));
DeactivateNote(smnote);
if(note.MotionSampleDisplay == null)
{
SetJudge(Judge.TestJudge(note, timing));
activatedNotes.Remove(note);
DeactivateNote(note);
}
}
})();
......
......@@ -14,6 +14,11 @@ public abstract class MotionNote : Note
: this(start, end) { }
public abstract IEnumerator Checkpoint();
public abstract bool FinalJudgeAction();
public bool IsChecked { get; protected set; }
public MotionSampleDisplay MotionSampleDisplay { get; set; }
public static readonly Dictionary<string, Type> keymap
= new Dictionary<string, Type>
......@@ -43,7 +48,7 @@ public abstract class MotionNote : Note
{ "RL", typeof(Guard) },
// Long motion
{ "BU", typeof(Guard) },
{ "BU", typeof(Clap) },
{ "LU", typeof(Guard) },
{ "RU", typeof(Guard) },
......@@ -62,8 +67,6 @@ public abstract class MotionNote : Note
protected static Sprite LoadNewSprite(string FilePath, float PixelsPerUnit = 100.0f)
{
return null;
Sprite NewSprite = new Sprite();
Texture2D SpriteTexture = LoadTexture(FilePath);
......@@ -72,7 +75,7 @@ public abstract class MotionNote : Note
NewSprite = Sprite.Create(SpriteTexture,
new Rect(0, 0, SpriteTexture.width, SpriteTexture.height),
new Vector2(0, 0), PixelsPerUnit);
new Vector2(0.5f, 0.5f), PixelsPerUnit);
return NewSprite;
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MotionSampleDisplay : MonoBehaviour {
[SerializeField]
GameObject left, right;
public Sprite sprite;
public float timeout;
public MotionNote caller;
private float elapsedTime;
private float parameter;
// Use this for initialization
void Start()
{
elapsedTime = 0f;
parameter = 0f;
left.GetComponent<SpriteRenderer>().sprite = sprite;
right.GetComponent<SpriteRenderer>().sprite = sprite;
}
// Update is called once per frame
void Update()
{
elapsedTime += Time.deltaTime * 1000;
if (elapsedTime > timeout / 2f)
parameter = (elapsedTime - timeout / 2f) / timeout;
if (elapsedTime > timeout)
{
Destroy(gameObject);
}
left.transform.Translate(new Vector3(parameter, 0));
right.transform.Translate(new Vector3(-parameter, 0));
}
}
fileFormatVersion: 2
guid: 5f8f9b9cb79ad63439e419b9f27ad79b
timeCreated: 1503592804
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 82e143d16729051459ae6a54b37e9eab
timeCreated: 18446744011573954816
guid: 7c71eb6382b65024390d02b33054ad2d
folderAsset: yes
timeCreated: 1501323034
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
......
#TITLE
#ARTIST
#GENRE
#BPM
#PLAYLEVEL
#000LBT 000000000000AA00000000000000000000AA000000000000
#000LMO 00000000000000000000HU00000000000000000000000000
#001LBT 0000000000000000000000000000AA0000000000000000AA
#001SMO 00000000000000000000000000000000000000JP00000000
#001LMO 0000000000000000000000HUHD0000000000000000000000
#002LBT 0000000000000000000000000000000000000000000000AA
#002SMO 00000000000000JP
#002LMO 0000000000000000000000000000000000000000HD000000
#003LBT 0000AA000000000000000000000000000000000000000000
fileFormatVersion: 2
guid: 85bafbe9b14b18b45b445b304b1f3efc
timeCreated: 18446744011573954816
guid: bd2b1c7e8a637614fa7f2af4a7b69fd3
timeCreated: 1503544726
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
......
#TITLE
#ARTIST
#GENRE
#BPM 120
#PLAYLEVEL 0
#000SBT 00000000AA00000000000000000000000000000000000000
#000LBT AA0000AA000000AA00000000000000000000000000000000
#000LMO 00000000000000HU00000000000000000000000000000000
#001LBT 000000000000AA000000000000000000AA00000000000000
#001LMO 00HU000000000000
#002LBT 00000000000000AA
#002SMO 00000000000000JP0000000000000000000000000000JP00
#002LMO 0000000000HD0000
00
#002LMO 0000000000HDJS00
fileFormatVersion: 2
guid: b65facb0c9c68b647b8ca7435b5f35c4
timeCreated: 18446744011573954816
guid: f6efc8d4fea10d94cb2f9e6ce362b4ec
timeCreated: 1503547554
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
......
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