Commit 5af15c0d authored by mmaluschnig's avatar mmaluschnig
Browse files

player receives feedback if they pressed the right order of notes and Simon...

player receives feedback if they pressed the right order of notes and Simon plays random notes during his turn.
parent 2f918911
......@@ -266,7 +266,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 870545035}
- m_Target: {fileID: 1447931352}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
......@@ -417,7 +417,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 870545035}
- m_Target: {fileID: 1447931352}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
......@@ -562,7 +562,7 @@ Transform:
m_GameObject: {fileID: 252927834}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.385, y: 0.434, 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: 609324339}
m_RootOrder: 0
......@@ -726,6 +726,7 @@ GameObject:
m_Component:
- component: {fileID: 609324339}
- component: {fileID: 609324338}
- component: {fileID: 609324340}
m_Layer: 0
m_Name: Simon
m_TagString: Untagged
......@@ -793,6 +794,19 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!114 &609324340
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 609324337}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4a9ec53774bf24fb984364506c95334c, type: 3}
m_Name:
m_EditorClassIdentifier:
note: {fileID: 1472882270331014, guid: 926e7a0b8d8d84ab8b306dcfd69c418c, type: 2}
noteManager: {fileID: 1447931352}
--- !u!1 &857273187
GameObject:
m_ObjectHideFlags: 0
......@@ -868,54 +882,6 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 857273187}
m_CullTransparentMesh: 0
--- !u!1 &870545033
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 870545034}
- component: {fileID: 870545035}
m_Layer: 0
m_Name: KeyManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &870545034
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 870545033}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &870545035
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 870545033}
m_Enabled: 1
m_EditorHideFlags: 0
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}
rButton: {fileID: 2131334773}
tButton: {fileID: 35780935}
yButton: {fileID: 1983109107}
--- !u!1 &896526786
GameObject:
m_ObjectHideFlags: 0
......@@ -992,7 +958,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 870545035}
- m_Target: {fileID: 1447931352}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
......@@ -1115,7 +1081,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 870545035}
- m_Target: {fileID: 1447931352}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
......@@ -1299,6 +1265,49 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1447931351
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1447931353}
- component: {fileID: 1447931352}
m_Layer: 0
m_Name: NoteManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1447931352
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1447931351}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aa0bbaf3d667543989f050741ad9f05f, type: 3}
m_Name:
m_EditorClassIdentifier:
playerNoteSpawn: {fileID: 69315318}
simonNoteSpawn: {fileID: 252927835}
note: {fileID: 1472882270331014, guid: 926e7a0b8d8d84ab8b306dcfd69c418c, type: 2}
--- !u!4 &1447931353
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1447931351}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1526102464
GameObject:
m_ObjectHideFlags: 0
......@@ -1374,6 +1383,81 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1526102464}
m_CullTransparentMesh: 0
--- !u!1 &1616255996
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1616255997}
- component: {fileID: 1616255999}
- component: {fileID: 1616255998}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1616255997
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1616255996}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2076225873}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1616255998
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1616255996}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Simons Turn
--- !u!222 &1616255999
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1616255996}
m_CullTransparentMesh: 0
--- !u!1 &1764000903
GameObject:
m_ObjectHideFlags: 0
......@@ -1383,6 +1467,7 @@ GameObject:
m_Component:
- component: {fileID: 1764000905}
- component: {fileID: 1764000904}
- component: {fileID: 1764000906}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
......@@ -1450,6 +1535,23 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1764000906
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764000903}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d6f3811ec749487c8bd2b388b0bf2ce, type: 3}
m_Name:
m_EditorClassIdentifier:
qButton: {fileID: 896526788}
wButton: {fileID: 1220043472}
eButton: {fileID: 102288115}
rButton: {fileID: 2131334773}
tButton: {fileID: 35780935}
yButton: {fileID: 1983109107}
--- !u!1 &1983109105
GameObject:
m_ObjectHideFlags: 0
......@@ -1526,7 +1628,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 870545035}
- m_Target: {fileID: 1447931352}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
......@@ -1664,6 +1766,7 @@ RectTransform:
- {fileID: 2131334772}
- {fileID: 35780934}
- {fileID: 1983109106}
- {fileID: 2076225873}
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -1747,6 +1850,129 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2066860501}
m_CullTransparentMesh: 0
--- !u!1 &2076225872
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2076225873}
- component: {fileID: 2076225876}
- component: {fileID: 2076225875}
- component: {fileID: 2076225874}
m_Layer: 5
m_Name: Simonsturn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2076225873
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2076225872}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1616255997}
m_Father: {fileID: 1997423556}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 210, y: 196}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2076225874
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2076225872}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 2076225875}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 609324340}
m_MethodName: setSimonsturn
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &2076225875
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2076225872}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &2076225876
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2076225872}
m_CullTransparentMesh: 0
--- !u!1 &2131334771
GameObject:
m_ObjectHideFlags: 0
......@@ -1823,7 +2049,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 870545035}
- m_Target: {fileID: 1447931352}
m_MethodName: spawnNote
m_Mode: 5
m_Arguments:
......
......@@ -10,6 +10,8 @@ public class Note : MonoBehaviour {
public float bobRate = 5;
public float bobScale = 0.5f;
public string type;
private float startTime;
// Use this for initialization
void Start () {
......
......@@ -20,14 +20,18 @@ public class NoteManager : MonoBehaviour {
public void spawnNote(string noteVal)
{
print(noteVal);
GameObject thisNote = Instantiate(note, playerNoteSpawn);
thisNote.GetComponent<SpriteRenderer>().color = keytoColor[noteVal];
thisNote.GetComponent<Note>().type = noteVal;
SimonGameManager.PlayerPlayed(thisNote);
}
public void spawnSimonNote(string noteVal){
//maybe change to int val for simon
GameObject thisNote = Instantiate(note, playerNoteSpawn);
GameObject thisNote = Instantiate(note, simonNoteSpawn);
thisNote.GetComponent<SpriteRenderer>().color = keytoColor[noteVal];
thisNote.GetComponent<Note>().type = noteVal;
SimonGameManager.SimonPlayed(thisNote);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimonGameManager : MonoBehaviour {
public static Queue<GameObject> simonNotes = new Queue<GameObject>();
public static void SimonPlayed(GameObject note){
simonNotes.Enqueue(note);
}
public static void PlayerPlayed(GameObject note){
GameObject sNote = simonNotes.Dequeue();
Note simonNote = sNote.GetComponent<Note>();
Note playerNote = note.GetComponent<Note>();
if(simonNote.type == playerNote.type){
print("GOOD");
}else{
print("BAD");
}
Destroy(sNote);
}
}
fileFormatVersion: 2
guid: a5bba54ad802d43bb8e1521d984095de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,15 +2,41 @@
using System.Collections.Generic;
using UnityEngine;
public class SimonScript : MonoBehaviour {
public class SimonScript : MonoBehaviour
{
//anyone wanna convert this to 'ook ook'?
// Use this for initialization
void Start () {
public GameObject note;
public NoteManager noteManager;
bool simonsTurn;
float playTime;
private string[] keys = new string[] {"Q","W","E","R","T","Y"};
// Use this for initialization
void Start () {
simonsTurn = true;
}
// Update is called once per frame
void Update () {
if(Time.time - playTime > 8){
setSimonsturn(false);
}
if (simonsTurn)
{
if ((Time.time - playTime) % 2 < 0.01f)
{
noteManager.spawnSimonNote(keys[Random.Range(0,6)]);
}
}
}
public void setSimonsturn(bool turn){
simonsTurn = turn;
playTime = Time.time;
}
}
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