diff --git a/Assets/Coffee.cs b/Assets/Coffee.cs new file mode 100644 index 0000000..ae54775 --- /dev/null +++ b/Assets/Coffee.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Coffee : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Coffee.cs.meta b/Assets/Coffee.cs.meta new file mode 100644 index 0000000..b767c82 --- /dev/null +++ b/Assets/Coffee.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b72c6073f9135a4894350d4cde51a76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Model/EventControlTile.cs b/Assets/Model/EventControlTile.cs index 6b87ac1..93a3e7e 100644 --- a/Assets/Model/EventControlTile.cs +++ b/Assets/Model/EventControlTile.cs @@ -12,16 +12,19 @@ namespace Assets.Model { public KeyCode keyCode; public Tile tile; + public Tile pressedTile; public Tile successTile; public Tile failTile; public Vector3Int position; public bool isPlusTile; public bool isPerformed; + public bool isPressed; - public EventControlTile(KeyCode keyCode, Tile tile, Tile successTile, Tile failTile, Vector3Int position, bool isPlusTile = false) + public EventControlTile(KeyCode keyCode, Tile tile, Tile pressedTile, Tile successTile, Tile failTile, Vector3Int position, bool isPlusTile = false) { this.keyCode = keyCode; this.tile = tile; + this.pressedTile = pressedTile; this.successTile = successTile; this.failTile = failTile; this.position = position; diff --git a/Assets/Prefabs/Coffee.prefab b/Assets/Prefabs/Coffee.prefab index b900435..af6d425 100644 --- a/Assets/Prefabs/Coffee.prefab +++ b/Assets/Prefabs/Coffee.prefab @@ -94,7 +94,7 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} - m_IsTrigger: 0 + m_IsTrigger: 1 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} diff --git a/Assets/Resources/Audio/Drink.ogg b/Assets/Resources/Audio/Drink.ogg index 508c509..d35a0f8 100644 Binary files a/Assets/Resources/Audio/Drink.ogg and b/Assets/Resources/Audio/Drink.ogg differ diff --git a/Assets/Resources/Audio/Drink.ogg.meta b/Assets/Resources/Audio/Drink.ogg.meta index 8efdd6f..72cf1aa 100644 --- a/Assets/Resources/Audio/Drink.ogg.meta +++ b/Assets/Resources/Audio/Drink.ogg.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 25942ecb34ea3764fad9cf75dc8a4f70 +guid: 08409a4626c473743bfad5cbdeced2f5 AudioImporter: externalObjects: {} serializedVersion: 6 diff --git a/Assets/Resources/Audio/HardPunch.ogg b/Assets/Resources/Audio/HardPunch.ogg index 992a534..acd3f19 100644 Binary files a/Assets/Resources/Audio/HardPunch.ogg and b/Assets/Resources/Audio/HardPunch.ogg differ diff --git a/Assets/Resources/Audio/HardPunch.ogg.meta b/Assets/Resources/Audio/HardPunch.ogg.meta index 4252a56..d372f7f 100644 --- a/Assets/Resources/Audio/HardPunch.ogg.meta +++ b/Assets/Resources/Audio/HardPunch.ogg.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3095e099213c73c4182d9feeae77ebbd +guid: a0bfa73aaf0db804f8fcb5658d35e9bb AudioImporter: externalObjects: {} serializedVersion: 6 diff --git a/Assets/Resources/Audio/HardSlap.ogg b/Assets/Resources/Audio/HardSlap.ogg index 45be628..a5bfbef 100644 Binary files a/Assets/Resources/Audio/HardSlap.ogg and b/Assets/Resources/Audio/HardSlap.ogg differ diff --git a/Assets/Resources/Audio/HardSlap.ogg.meta b/Assets/Resources/Audio/HardSlap.ogg.meta index 7f9b79d..1f0e78f 100644 --- a/Assets/Resources/Audio/HardSlap.ogg.meta +++ b/Assets/Resources/Audio/HardSlap.ogg.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 292f0e8e04642864daaf315efade99c7 +guid: 790b6cf6ea95f82488f7f9dc1957cafc AudioImporter: externalObjects: {} serializedVersion: 6 diff --git a/Assets/Resources/Audio/Punch.ogg b/Assets/Resources/Audio/Punch.ogg index 9c8b8b7..b272f9f 100644 Binary files a/Assets/Resources/Audio/Punch.ogg and b/Assets/Resources/Audio/Punch.ogg differ diff --git a/Assets/Resources/Audio/Punch.ogg.meta b/Assets/Resources/Audio/Punch.ogg.meta index 5877632..59e28bb 100644 --- a/Assets/Resources/Audio/Punch.ogg.meta +++ b/Assets/Resources/Audio/Punch.ogg.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 33e618f5ded88f7449cf8c6b88e71c8f +guid: 5ca1e8b3336d7554e98fc272bf1370cd AudioImporter: externalObjects: {} serializedVersion: 6 diff --git a/Assets/Resources/Audio/Slap.ogg b/Assets/Resources/Audio/Slap.ogg index d0169ab..1a058ca 100644 Binary files a/Assets/Resources/Audio/Slap.ogg and b/Assets/Resources/Audio/Slap.ogg differ diff --git a/Assets/Resources/Audio/Slap.ogg.meta b/Assets/Resources/Audio/Slap.ogg.meta index 36a929d..8f85f8f 100644 --- a/Assets/Resources/Audio/Slap.ogg.meta +++ b/Assets/Resources/Audio/Slap.ogg.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: aafb1c137c5574744b6c2c5b7d5e7055 +guid: 1e1a4d27514614d41b68c68ab0d147d9 AudioImporter: externalObjects: {} serializedVersion: 6 diff --git a/Assets/Scenes/LevelOne.unity b/Assets/Scenes/LevelOne.unity index 1006d0a..f47d6aa 100644 --- a/Assets/Scenes/LevelOne.unity +++ b/Assets/Scenes/LevelOne.unity @@ -175,6 +175,13 @@ MonoBehaviour: - {fileID: 11400000, guid: bfe2d3906a2ea9a459088706930d84a6, type: 2} - {fileID: 11400000, guid: eb62aa8f449e99a499ed3a9dde109158, type: 2} - {fileID: 11400000, guid: 3892d3fd4f09d3546a9c0fa91c23804c, type: 2} + pressedTiles: + - {fileID: 11400000, guid: ae6e7a8b9fa2433448a66da4090e310c, type: 2} + - {fileID: 11400000, guid: ccb4ffcdbc096b448881b3a12ed1bfce, type: 2} + - {fileID: 11400000, guid: f3b494a9dede1e34cbf612b95ee136ec, type: 2} + - {fileID: 11400000, guid: a6df840757ade3b4b91133bd128a4ca7, type: 2} + - {fileID: 11400000, guid: 8e4de2f5a5925ad47b2e5135946daee7, type: 2} + - {fileID: 11400000, guid: 8a9fda06d52381844891193f6ed6bb07, type: 2} successTiles: - {fileID: 11400000, guid: c2678bd928e9a0943ad5fadb602db819, type: 2} - {fileID: 11400000, guid: db1d65b4da209fa489ba3d7582dbff24, type: 2} @@ -190,7 +197,7 @@ MonoBehaviour: - {fileID: 11400000, guid: aa0847f2d07a5de409fea20d9eef8f98, type: 2} - {fileID: 11400000, guid: 4a575a19b6cd8a140959a1461963418f, type: 2} plusTile: {fileID: 11400000, guid: ee14e10b7ac07bd449e0f1d5ea99eb42, type: 2} - framesPerControlTile: 8 + framesPerControlTile: 3 nextControlYOffset: 2 tileMapClearDelayInSeconds: 0.5 --- !u!483693784 &1491656 @@ -397,6 +404,11 @@ PrefabInstance: propertyPath: m_Size.y value: 1.3199286 objectReference: {fileID: 0} + - target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146, + type: 3} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} propertyPath: m_Name @@ -410,12 +422,12 @@ PrefabInstance: - target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} propertyPath: m_LocalPosition.x - value: 133.11 + value: 132.4 objectReference: {fileID: 0} - target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} propertyPath: m_LocalPosition.y - value: -13.99 + value: -18.2 objectReference: {fileID: 0} - target: {fileID: 7123021364386132083, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} @@ -462,7 +474,8 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 1518483160148691188, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} --- !u!1001 &170428179 PrefabInstance: @@ -486,6 +499,11 @@ PrefabInstance: propertyPath: m_SortingLayer value: 1 objectReference: {fileID: 0} + - target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146, + type: 3} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} propertyPath: m_Name @@ -1426,6 +1444,11 @@ PrefabInstance: propertyPath: m_SortingLayer value: 1 objectReference: {fileID: 0} + - target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146, + type: 3} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} propertyPath: m_Name @@ -1951,6 +1974,11 @@ PrefabInstance: propertyPath: m_Size.y value: 1.3281136 objectReference: {fileID: 0} + - target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146, + type: 3} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} propertyPath: m_Name @@ -47439,6 +47467,11 @@ PrefabInstance: propertyPath: m_SortingLayer value: 1 objectReference: {fileID: 0} + - target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146, + type: 3} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} propertyPath: m_Name @@ -47771,6 +47804,7 @@ Transform: m_GameObject: {fileID: 1671840916} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 37, y: -13, z: 0} + m_LocalPosition: {x: -10.5, y: 4, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1008122163} @@ -48977,6 +49011,11 @@ PrefabInstance: propertyPath: m_Size.y value: 1.31913 objectReference: {fileID: 0} + - target: {fileID: 5520736153122788072, guid: 2ccb08e2c4b8851498f8ecbf1a873146, + type: 3} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6870250841519595495, guid: 2ccb08e2c4b8851498f8ecbf1a873146, type: 3} propertyPath: m_Name diff --git a/Assets/Scripts/EventControls.cs b/Assets/Scripts/EventControls.cs index 91f7087..94281d6 100644 --- a/Assets/Scripts/EventControls.cs +++ b/Assets/Scripts/EventControls.cs @@ -11,6 +11,7 @@ public class EventControls : MonoBehaviour [SerializeField] private Camera camera; [SerializeField] private GameObject music; [SerializeField] private List tiles; + [SerializeField] private List pressedTiles; [SerializeField] private List successTiles; [SerializeField] private List failTiles; [SerializeField] private Tile plusTile; @@ -43,6 +44,7 @@ public class EventControls : MonoBehaviour private EventControlTile currentEventControl; private bool isInBattle = false; private bool hasFailed = false; + private int buttonPressAnimationAccumalator = 0; private Collider2D currentPlayerCollider; private Collider2D currentEnemyCollider; @@ -177,6 +179,18 @@ public class EventControls : MonoBehaviour if (currentEventControl == null) currentEventControl = eventControlTilesInCycle.First(x => !x.isPlusTile && !x.isPerformed); + else + { + if (buttonPressAnimationAccumalator >= framesPerControlTile) + { + tilemap.SetTile(currentEventControl.position, currentEventControl.isPressed ? currentEventControl.pressedTile : + currentEventControl.tile); + currentEventControl.isPressed = !currentEventControl.isPressed; + buttonPressAnimationAccumalator = 0; + } + else + buttonPressAnimationAccumalator++; + } if (Input.GetKeyDown(currentEventControl.keyCode)) { @@ -203,7 +217,7 @@ public class EventControls : MonoBehaviour return; } - else if (eventCycleAccumalator >= eventCycleInSeconds * framesPerSecond) + else if (eventCycleAccumalator >= eventCycleInSeconds * framesPerSecond * player.GetStaminaDifficultyFactor()) { eventTriggered = false; isInBattle = false; @@ -294,6 +308,7 @@ public class EventControls : MonoBehaviour return new EventControlTile(TileToKeyMappings.TileToKey[randomNumber], tiles[randomNumber], + pressedTiles[randomNumber], successTiles[randomNumber], failTiles[randomNumber], position); @@ -305,6 +320,7 @@ public class EventControls : MonoBehaviour plusTile, null, null, + null, position, true); } diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index 7bac19c..cf8d4e8 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -80,6 +80,7 @@ public class Player : MonoBehaviour { if (coll.gameObject.tag == "Pizza") { + SoundManagerScript.PlaySound("eat"); Destroy(coll.gameObject); currentHealth += currentHealth < startHealth ? 1 : 0; healthBar.size = new Vector2(1.5f * currentHealth, this.healthBar.size.y); @@ -115,6 +116,7 @@ public class Player : MonoBehaviour private void Hurt() { + currentHealth = 3; // TODO: REMOVE! currentHealth -= currentHealth > 0 ? 1 : 0; healthBar.size = new Vector2(1.5f * currentHealth, this.healthBar.size.y); @@ -181,6 +183,16 @@ public class Player : MonoBehaviour { rigidBody.velocity = new Vector2(actualRunSpeed * -1, rigidBody.velocity.y); } + + // Run + if (Input.GetKeyUp(KeyCode.RightArrow)) + { + rigidBody.velocity = new Vector2(0, rigidBody.velocity.y); + } + else if (Input.GetKeyUp(KeyCode.LeftArrow)) + { + rigidBody.velocity = new Vector2(0, rigidBody.velocity.y); + } } private bool IsPlayerOnGround() @@ -289,4 +301,9 @@ public class Player : MonoBehaviour isHurt = true; Hurt(); } + + public float GetStaminaDifficultyFactor() + { + return currentStamina / (startStamina * 1f); + } }