Commit 3472a876 authored by mmaluschnig's avatar mmaluschnig
Browse files

Notes now spawn with a colour when corresponding keys are presed.

parent 6b2a8039
%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_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1472882270331014}
m_IsPrefabAsset: 1
--- !u!1 &1472882270331014
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4731948051586198}
- component: {fileID: 212976462230972336}
- component: {fileID: 114798623192262906}
m_Layer: 0
m_Name: Note
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4731948051586198
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1472882270331014}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114798623192262906
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1472882270331014}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a49dc24af4f549b8a0f3d461d95cd3d, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 0.6
persistTime: 10
bobRate: 5
bobScale: 0.5
--- !u!212 &212976462230972336
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1472882270331014}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
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_StitchLightmapSeams: 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: 21300000, guid: 8f8293d2fe03d4f8f950fadad1125e41, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 5.12, y: 5.12}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
fileFormatVersion: 2
guid: 926e7a0b8d8d84ab8b306dcfd69c418c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -265,7 +265,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 35780936}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 870545035}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument: T
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &35780936
......@@ -280,7 +291,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.043137256, g: 0.14117648, b: 0.9843138, a: 1}
m_Color: {r: 0, g: 0, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
......@@ -325,7 +336,7 @@ Transform:
m_GameObject: {fileID: 69315317}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.55, y: 0.38, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
m_Children: []
m_Father: {fileID: 1764000905}
m_RootOrder: 0
......@@ -405,7 +416,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 102288116}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 870545035}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument: E
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &102288116
......@@ -420,7 +442,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0.9921569, b: 0.21960786, a: 1}
m_Color: {r: 1, g: 1, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
......@@ -886,6 +908,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5d6f3811ec749487c8bd2b388b0bf2ce, type: 3}
m_Name:
m_EditorClassIdentifier:
note: {fileID: 1472882270331014, guid: 926e7a0b8d8d84ab8b306dcfd69c418c, type: 2}
playerNoteSpawn: {fileID: 69315318}
qButton: {fileID: 896526788}
wButton: {fileID: 1220043472}
eButton: {fileID: 102288115}
......@@ -967,7 +991,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 896526789}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 870545035}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument: Q
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &896526789
......@@ -1004,97 +1039,6 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 896526786}
m_CullTransparentMesh: 0
--- !u!1 &950038733
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 950038736}
- component: {fileID: 950038735}
- component: {fileID: 950038734}
m_Layer: 0
m_Name: Note
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &950038734
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 950038733}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a49dc24af4f549b8a0f3d461d95cd3d, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 0.8
persistTime: 10
bobRate: 5
bobScale: 0.5
--- !u!212 &950038735
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 950038733}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
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_StitchLightmapSeams: 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: 21300000, guid: 8f8293d2fe03d4f8f950fadad1125e41, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 5.12, y: 5.12}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &950038736
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 950038733}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.45, y: 1.16, z: -0.095703125}
m_LocalScale: {x: 0.2, y: 0.2, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1220043470
GameObject:
m_ObjectHideFlags: 0
......@@ -1170,7 +1114,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1220043473}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 870545035}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument: W
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &1220043473
......@@ -1185,7 +1140,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9921569, g: 0.49803925, b: 0.13725491, a: 1}
m_Color: {r: 1, g: 0.49803925, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
......@@ -1267,7 +1222,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1244754177
GameObject:
......@@ -1570,7 +1525,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1983109108}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 870545035}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument: Y
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &1983109108
......@@ -1585,7 +1551,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.98823535, g: 0.15686275, b: 0.98823535, a: 1}
m_Color: {r: 1, g: 0, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
......@@ -1699,7 +1665,7 @@ RectTransform:
- {fileID: 35780934}
- {fileID: 1983109106}
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
......@@ -1856,7 +1822,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 2131334774}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 870545035}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument: R
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &2131334774
......@@ -1871,7 +1848,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.16078432, g: 0.9921569, b: 0.18431373, a: 1}
m_Color: {r: 0, g: 1, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
......
......@@ -6,15 +6,27 @@ using UnityEngine.EventSystems;
public class KeyPressManager : MonoBehaviour {
public GameObject note;
public Transform playerNoteSpawn;
public Button qButton;
public Button wButton;
public Button eButton;
public Button rButton;
public Button tButton;
public Button yButton;
public Button yButton;
Dictionary<string, Color> keytoColor;
// Use this for initialization
void Start () {
keytoColor = new Dictionary<string, Color>() {
{"Q",Color.red},
{"W",new Color(1,0.5f,0)},
{"E",Color.yellow},
{"R",Color.green},
{"T",Color.blue},
{"Y",Color.magenta}
};
}
// Update is called once per frame
......@@ -45,6 +57,11 @@ public class KeyPressManager : MonoBehaviour {
{
ExecuteEvents.Execute(yButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
}
public void spawnNote(string noteVal){
print(noteVal);
GameObject thisNote = Instantiate(note, playerNoteSpawn);
thisNote.GetComponent<SpriteRenderer>().color = keytoColor[noteVal];
}
}
......@@ -4,7 +4,7 @@ using UnityEngine;
public class Note : MonoBehaviour {
public float speed = 0.8f;
public float speed = 0.6f;
public float persistTime = 10;
public float bobRate = 5;
......@@ -21,7 +21,7 @@ public class Note : MonoBehaviour {
{
//change position
float dy = bobScale * Mathf.Sin(bobRate * Time.time);
transform.Translate(new Vector2(speed,dy + (0.6f * speed)) * Time.deltaTime);
transform.Translate(new Vector2(speed,dy + (0.4f * speed)) * Time.deltaTime);
//fade away
float uptime = Time.time - startTime;
......
Supports Markdown
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