Commit b64ee28b authored by mmaluschnig's avatar mmaluschnig
Browse files

Merge remote-tracking branch 'origin/master' into piethrowing

* origin/master:
  fixed bear texture in SimonTheBear scene
  added textures
  Added Silas the mime to textures
  changed label sizes in canvas so Simon turn button not covered up
  added score and combo functionality but Simons turn button broke
  Simon now plays notes to a 'metronome' tune (but has a chance to not play because he's a bear).
  player receives feedback if they pressed the right order of notes and Simon plays random notes during his turn.
  changed the way that notes are spawned by having a single NoteManager
  Notes now spawn with a colour when corresponding keys are presed.
  saved scene for commit 670c47cc
  added buttons and a script to press the buttons when the corresponding key is pressed
  Added simon the bear to textures
  added a note that bobs away from its location
  created the initial scene
parents 726003fd 68f9e99c
%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:
This diff is collapsed.
fileFormatVersion: 2
guid: eb145a155bae9435aa1a9e3d9993a91f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3c1d530a08eed4b5d98ba641308832c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class KeyPressManager : MonoBehaviour {
public Button qButton;
public Button wButton;
public Button eButton;
public Button rButton;
public Button tButton;
public Button yButton;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update()
{
//call buttons submit event when the player presses the corresponding key
var pointer = new PointerEventData(EventSystem.current);
if (Input.GetKeyDown(KeyCode.Q))
{
ExecuteEvents.Execute(qButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
if (Input.GetKeyDown(KeyCode.W))
{
ExecuteEvents.Execute(wButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
if (Input.GetKeyDown(KeyCode.E))
{
ExecuteEvents.Execute(eButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
if (Input.GetKeyDown(KeyCode.R))
{
ExecuteEvents.Execute(rButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
if (Input.GetKeyDown(KeyCode.T))
{
ExecuteEvents.Execute(tButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
if (Input.GetKeyDown(KeyCode.Y))
{
ExecuteEvents.Execute(yButton.gameObject, pointer, ExecuteEvents.submitHandler);
}
}
}
fileFormatVersion: 2
guid: 5d6f3811ec749487c8bd2b388b0bf2ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Note : MonoBehaviour {
public float speed = 0.6f;
public float persistTime = 10;
public float bobRate = 5;
public float bobScale = 0.5f;
public string type;
public int points = 10;
private float startTime;
// Use this for initialization
void Start () {
startTime = Time.time;
}
// Update is called once per frame
void Update()
{
//change position
float dy = bobScale * Mathf.Sin(bobRate * Time.time);
transform.Translate(new Vector2(speed,dy + (0.4f * speed)) * Time.deltaTime);
//fade away
float uptime = Time.time - startTime;
SpriteRenderer sprite = GetComponent<SpriteRenderer>();
Color tempColour = sprite.color;
tempColour.a = 1 - (uptime / persistTime);
sprite.color = tempColour;
if (Time.time >= startTime + persistTime)
{
Destroy(gameObject);
}
}
}
fileFormatVersion: 2
guid: 3a49dc24af4f549b8a0f3d461d95cd3d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NoteManager : MonoBehaviour {
public Transform playerNoteSpawn;
public Transform simonNoteSpawn;
public GameObject note;
static Dictionary<string, Color> 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}
};
public void spawnNote(string 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, simonNoteSpawn);
thisNote.GetComponent<SpriteRenderer>().color = keytoColor[noteVal];
thisNote.GetComponent<Note>().type = noteVal;
SimonGameManager.SimonPlayed(thisNote);
}
}
fileFormatVersion: 2
guid: aa0bbaf3d667543989f050741ad9f05f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimonGameManager : MonoBehaviour {
public static Queue<GameObject> simonNotes = new Queue<GameObject>();
public static float score;
public static int combo;
public static void SimonPlayed(GameObject note){
simonNotes.Enqueue(note);
}
public static void PlayerPlayed(GameObject note){
if (simonNotes.Count > 0)
{
GameObject sNote = simonNotes.Dequeue();
Note simonNote = sNote.GetComponent<Note>();
Note playerNote = note.GetComponent<Note>();
if (simonNote.type == playerNote.type)
{
HitNote(playerNote.points);
}
else
{
MissNote();
}
Destroy(sNote);
}else{
print("Dont be hasty master Hobbit");
}
}
static void HitNote(int points){
print("GOOD");
score += points;
combo++;
}
static void MissNote(){
print("BAD");
combo = 0;
}
}
fileFormatVersion: 2
guid: a5bba54ad802d43bb8e1521d984095de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimonScript : MonoBehaviour
{
//anyone wanna convert this to 'ook ook'?
public GameObject note;
public NoteManager noteManager;
public float turnTime = 8;
bool simonsTurn;
float playTime;
float nextNotePlay;
public float notePlaySpeed = 0.3f;
public float notePlayChance = 0.3f;
private string[] keys = new string[] {"Q","W","E","R","T","Y"};
// Use this for initialization
void Start () {
simonsTurn = true;
nextNotePlay = Time.time;
}
// Update is called once per frame
void Update () {
//simon plays for 'turnTime' seconds then waits patiently like a well trained bear
if(Time.time - playTime > turnTime){
setSimonsturn(false);
}
if (simonsTurn)
{
//simon will attempt to play every 'notePlaySpeed' seconds
if (Time.time > nextNotePlay)
{
nextNotePlay += notePlaySpeed;
//however hes a bear so he screws up a lot
if (Random.Range(0f, 1f) < notePlayChance)
{
playRandomNote();
}
}
}
}
void playRandomNote(){
noteManager.spawnSimonNote(keys[Random.Range(0, 6)]);
}
public void setSimonsturn(bool turn){
simonsTurn = turn;
playTime = Time.time;
}
}
fileFormatVersion: 2
guid: 4a9ec53774bf24fb984364506c95334c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UIManager : MonoBehaviour {
public Text scoreText;
public Text comboText;
// Use this for initialization
void Start () {
scoreText.text = "Score: " + SimonGameManager.score;
comboText.text = "Combo: " + SimonGameManager.combo;
}
void Update () {
scoreText.text = "Score: " + SimonGameManager.score;
comboText.text = "Combo: " + SimonGameManager.combo;
}
}
fileFormatVersion: 2
guid: 5de4f2786b5924ce7a842fb42c1ba88c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3ae1b490507d79e4ca407331d7098f81
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
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}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: cb2e6e3bfe182764e8dff9966d425646
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
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