diff --git a/Assets/Audio/beneath-surface-3.ogg.meta b/Assets/Audio/beneath-surface-3.ogg.meta new file mode 100644 index 0000000..3e66f4b --- /dev/null +++ b/Assets/Audio/beneath-surface-3.ogg.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 36ecdbbae90239a4ea972d8b1517f5d3 +AudioImporter: + serializedVersion: 4 + format: 0 + quality: -1 + stream: 1 + 3D: 1 + forceToMono: 0 + useHardware: 0 + loopable: 0 + userData: diff --git a/Assets/Audio/beneath-surface-4.ogg.meta b/Assets/Audio/beneath-surface-4.ogg.meta new file mode 100644 index 0000000..5cb931b --- /dev/null +++ b/Assets/Audio/beneath-surface-4.ogg.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7f70abf26ead3304fa0fd0aa1e57992e +AudioImporter: + serializedVersion: 4 + format: 0 + quality: -1 + stream: 1 + 3D: 1 + forceToMono: 0 + useHardware: 0 + loopable: 0 + userData: diff --git a/Assets/Audio/shank.mp3.meta b/Assets/Audio/shank.mp3.meta new file mode 100644 index 0000000..fe89dd2 --- /dev/null +++ b/Assets/Audio/shank.mp3.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d7b1c5faa669f6146a725ae85236bae9 +AudioImporter: + serializedVersion: 4 + format: 0 + quality: -1 + stream: 1 + 3D: 1 + forceToMono: 0 + useHardware: 0 + loopable: 0 + userData: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 5d694c0..6c1bd7f 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -152,7 +152,6 @@ GameObject: m_Component: - 4: {fileID: 57666823} - 65: {fileID: 57666826} - - 82: {fileID: 57666824} m_Layer: 0 m_Name: Shank Spawn m_TagString: Untagged @@ -171,65 +170,6 @@ Transform: m_LocalScale: {x: 1, y: .0909090862, z: .0500000007} m_Children: [] m_Father: {fileID: 745975992} ---- !u!82 &57666824 -AudioSource: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 8200000, guid: 0dd5d3e41887306468e6f9dd9d58b975, - type: 2} - m_PrefabInternal: {fileID: 296847678} - m_GameObject: {fileID: 57666822} - m_Enabled: 1 - serializedVersion: 3 - m_audioClip: {fileID: 8300000, guid: b189fb0007b0fc148a287b20274b0b51, type: 3} - m_PlayOnAwake: 1 - m_Volume: 1 - m_Pitch: 1 - Loop: 0 - Mute: 0 - Priority: 128 - DopplerLevel: 1 - MinDistance: 1 - MaxDistance: 500 - Pan2D: 0 - rolloffMode: 0 - BypassEffects: 0 - BypassListenerEffects: 0 - BypassReverbZones: 0 - rolloffCustomCurve: - serializedVersion: 2 - m_Curve: - - time: 0 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - - time: 1 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - panLevelCustomCurve: - serializedVersion: 2 - m_Curve: - - time: 0 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - spreadCustomCurve: - serializedVersion: 2 - m_Curve: - - time: 0 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 --- !u!65 &57666826 BoxCollider: m_ObjectHideFlags: 0 @@ -377,7 +317,6 @@ GameObject: - 4: {fileID: 146718572} - 114: {fileID: 146718573} - 54: {fileID: 146718574} - - 82: {fileID: 146718575} m_Layer: 0 m_Name: Player m_TagString: Untagged @@ -432,64 +371,6 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 0 m_CollisionDetection: 0 ---- !u!82 &146718575 -AudioSource: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 146718571} - m_Enabled: 1 - serializedVersion: 3 - m_audioClip: {fileID: 8300000, guid: b189fb0007b0fc148a287b20274b0b51, type: 3} - m_PlayOnAwake: 0 - m_Volume: 1 - m_Pitch: 1 - Loop: 0 - Mute: 0 - Priority: 128 - DopplerLevel: 1 - MinDistance: 1 - MaxDistance: 500 - Pan2D: 0 - rolloffMode: 0 - BypassEffects: 0 - BypassListenerEffects: 0 - BypassReverbZones: 0 - rolloffCustomCurve: - serializedVersion: 2 - m_Curve: - - time: 0 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - - time: 1 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - panLevelCustomCurve: - serializedVersion: 2 - m_Curve: - - time: 0 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - spreadCustomCurve: - serializedVersion: 2 - m_Curve: - - time: 0 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 --- !u!1001 &296847678 Prefab: m_ObjectHideFlags: 0 @@ -553,6 +434,7 @@ Prefab: - {fileID: 11400000, guid: 0dd5d3e41887306468e6f9dd9d58b975, type: 2} - {fileID: 2300000, guid: 0dd5d3e41887306468e6f9dd9d58b975, type: 2} - {fileID: 3300000, guid: 0dd5d3e41887306468e6f9dd9d58b975, type: 2} + - {fileID: 8200000, guid: 0dd5d3e41887306468e6f9dd9d58b975, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 0dd5d3e41887306468e6f9dd9d58b975, type: 2} m_RootGameObject: {fileID: 57666822} m_IsPrefabParent: 0 @@ -987,6 +869,7 @@ GameObject: - 65: {fileID: 768198793} - 23: {fileID: 768198792} - 95: {fileID: 768198795} + - 114: {fileID: 768198796} m_Layer: 0 m_Name: North Wall m_TagString: Untagged @@ -1059,6 +942,20 @@ Animator: m_ApplyRootMotion: 1 m_AnimatePhysics: 0 m_HasTransformHierarchy: 1 +--- !u!114 &768198796 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 768198790} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 704d6d277dc28fa4c8a6a28688efd5a3, type: 3} + m_Name: + m_EditorClassIdentifier: + columns: 1 + rows: 2 + framesPerSecond: 10 --- !u!1 &787766216 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/AnimateSprite.cs b/Assets/Scripts/AnimateSprite.cs new file mode 100644 index 0000000..995af07 --- /dev/null +++ b/Assets/Scripts/AnimateSprite.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using System.Collections; + +public class AnimateSprite : MonoBehaviour { + + public int columns = 2; + public int rows = 2; + public float framesPerSecond = 10f; + + //the current frame to display + private int index = 0; + + void Start() + { + StartCoroutine(updateTiling()); + + //set the tile size of the texture (in UV units), based on the rows and columns + Vector2 size = new Vector2(1f / columns, 1f / rows); + renderer.sharedMaterial.SetTextureScale("_MainTex", size); + } + + private IEnumerator updateTiling() + { + while (true) + { + //move to the next index + index++; + if (index >= rows * columns) + index = 0; + + //split into x and y indexes + Vector2 offset = new Vector2((float)index / columns - (index / columns), //x index + (index / columns) / (float)rows); //y index + + renderer.sharedMaterial.SetTextureOffset("_MainTex", offset); + + yield return new WaitForSeconds(1f / framesPerSecond); + } + + } +} diff --git a/Assets/Scripts/AnimateSprite.cs.meta b/Assets/Scripts/AnimateSprite.cs.meta new file mode 100644 index 0000000..655a90f --- /dev/null +++ b/Assets/Scripts/AnimateSprite.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 704d6d277dc28fa4c8a6a28688efd5a3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs new file mode 100644 index 0000000..8df3396 --- /dev/null +++ b/Assets/Scripts/GameController.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using System.Collections; + +public class GameController : MonoBehaviour { + + public int swigs; + public GUIText swigText; + + // Use this for initialization + void Start () { + UpdateSwigText (); + } + + // Update is called once per frame + void Update () { + + } + + public void TakeSwig() { + swigs -= 1; + UpdateSwigText(); + } + + void UpdateSwigText() { + swigText.text = "Swigs Left: " + swigs; + } +} diff --git a/Assets/Scripts/GameController.cs.meta b/Assets/Scripts/GameController.cs.meta new file mode 100644 index 0000000..ff181ec --- /dev/null +++ b/Assets/Scripts/GameController.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cc84b14a55660b643805ae0f1878c40b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index f3f35e5..69b4d0a 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -11,22 +11,30 @@ public class PlayerController : MonoBehaviour { public Transform shankSpawn; public GameObject vvAura; public int swigCounter; - private int swigs = 0; + private GameController gameController; + + void Start() { + GameObject gameControllerObject = GameObject.FindWithTag("GameController"); + + if (gameControllerObject != null) + gameController = gameControllerObject.GetComponent (); + else + Debug.Log("Cannot find GameController script."); + } void Update() { if (Input.GetButton("Fire1") && Time.time > nextFire) { - //audio.Play (); nextFire = Time.time + delay; Instantiate(shank, shankSpawn.position, playerAngle.rotation); } - if (Input.GetButton("ActivateVV") && swigs < swigCounter && Time.time > nextFire) + if (Input.GetButton("ActivateVV") && gameController.swigs > 0 && Time.time > nextFire) { nextFire = Time.time + delay * 2; Instantiate (vvAura, rigidbody.position, rigidbody.rotation); - swigs++; + gameController.TakeSwig(); } } @@ -36,11 +44,11 @@ public class PlayerController : MonoBehaviour { if (moveHorizontal < 0) playerAngle.eulerAngles = new Vector3(0f, -180f, 0f); - else if (moveHorizontal > 0) + if (moveHorizontal > 0) playerAngle.eulerAngles = new Vector3(0f, 0f, 0f); - else if (moveVertical < 0) + if (moveVertical < 0) playerAngle.eulerAngles = new Vector3(0f, -270f, 0f); - else if (moveVertical > 0) + if (moveVertical > 0) playerAngle.eulerAngles = new Vector3(0f, -90f, 0f); Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical); diff --git a/Assets/Sprites/Materials/brickwal-not-animatedl0.mat b/Assets/Sprites/Materials/brickwal-not-animatedl0.mat index 7d2f9ae..d32a17a 100644 --- a/Assets/Sprites/Materials/brickwal-not-animatedl0.mat +++ b/Assets/Sprites/Materials/brickwal-not-animatedl0.mat @@ -17,8 +17,8 @@ Material: first: name: _MainTex second: - m_Texture: {fileID: 2800000, guid: f24a3f9e912f9b14b98097a9d998cfbc, type: 3} - m_Scale: {x: 2, y: 1} + m_Texture: {fileID: 2800000, guid: 26c9dff0fed396341b045e42e3a0b500, type: 3} + m_Scale: {x: 1, y: .5} m_Offset: {x: 0, y: 0} m_Floats: {} m_Colors: