From d19aba3a726b463975843362d083179378175336 Mon Sep 17 00:00:00 2001 From: Santi Date: Mon, 24 Jun 2024 23:53:55 +0100 Subject: [PATCH] Mostly Comments --- Assets/Scenes/ObjectMinigameTests.unity | 392 +++++++++++++++++++++++- Assets/Scenes/Whack-A-Mole.unity | 7 +- Assets/Scripts/BoxTeleport.cs | 12 +- Assets/Scripts/Colours.cs | 5 +- Assets/Scripts/Hamor.cs | 10 +- Assets/Scripts/Moles.cs | 1 - Assets/Scripts/Movement.cs | 8 +- Assets/Scripts/PickUpObject.cs | 6 - Assets/Scripts/Timer.cs | 2 +- 9 files changed, 426 insertions(+), 17 deletions(-) diff --git a/Assets/Scenes/ObjectMinigameTests.unity b/Assets/Scenes/ObjectMinigameTests.unity index fda7fa1..f41ae74 100644 --- a/Assets/Scenes/ObjectMinigameTests.unity +++ b/Assets/Scenes/ObjectMinigameTests.unity @@ -23481,6 +23481,124 @@ Transform: m_Father: {fileID: 1308571410} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &230613657 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 230613662} + - component: {fileID: 230613661} + - component: {fileID: 230613660} + - component: {fileID: 230613659} + - component: {fileID: 230613658} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &230613658 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230613657} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 74dc49a8baecbbb48949a88ac16ad421, type: 3} + m_Name: + m_EditorClassIdentifier: + timeRemaining: 120 + timeText: {fileID: 493173114} +--- !u!114 &230613659 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230613657} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &230613660 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230613657} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &230613661 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230613657} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &230613662 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230613657} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2074756334} + - {fileID: 493173116} + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} --- !u!43 &333713881 Mesh: m_ObjectHideFlags: 0 @@ -35488,6 +35606,141 @@ Transform: m_Father: {fileID: 1308571410} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &493173113 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 493173116} + - component: {fileID: 493173115} + - component: {fileID: 493173114} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &493173114 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 493173113} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Time Left: ' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &493173115 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 493173113} + m_CullTransparentMesh: 1 +--- !u!224 &493173116 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 493173113} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 237} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 230613662} + m_RootOrder: 1 + 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: -394.6, y: 438} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} --- !u!43 &629826800 Mesh: m_ObjectHideFlags: 0 @@ -36082,6 +36335,7 @@ MonoBehaviour: rightKey: 101 sprintKey: 304 jumpKey: 32 + hammer: 0 --- !u!114 &765999536 MonoBehaviour: m_ObjectHideFlags: 0 @@ -59765,7 +60019,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1123558005} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 9.07, y: 0.78, z: -6.01} + m_LocalPosition: {x: 200.3, y: 0.78, z: -68.2} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -59877,6 +60131,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: waitTime: 3 + scoreText: {fileID: 2074756335} --- !u!43 &1255666084 Mesh: m_ObjectHideFlags: 0 @@ -96058,6 +96313,141 @@ MeshCollider: m_Convex: 0 m_CookingOptions: 30 m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &2074756333 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2074756334} + - component: {fileID: 2074756336} + - component: {fileID: 2074756335} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2074756334 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2074756333} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 230613662} + m_RootOrder: 0 + 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: 45, y: 437} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2074756335 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2074756333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Score: ' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &2074756336 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2074756333} + m_CullTransparentMesh: 1 --- !u!1 &2117739596 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Whack-A-Mole.unity b/Assets/Scenes/Whack-A-Mole.unity index 5fbe5e6..47c4aba 100644 --- a/Assets/Scenes/Whack-A-Mole.unity +++ b/Assets/Scenes/Whack-A-Mole.unity @@ -747,7 +747,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 74dc49a8baecbbb48949a88ac16ad421, type: 3} m_Name: m_EditorClassIdentifier: - timeRemaining: 180 + timeRemaining: 120 timeText: {fileID: 169935476} --- !u!1 &365973832 GameObject: @@ -1842,6 +1842,7 @@ MonoBehaviour: rightKey: 101 sprintKey: 304 jumpKey: 32 + hammer: 0 --- !u!136 &1452868883 CapsuleCollider: m_ObjectHideFlags: 0 @@ -3771,11 +3772,14 @@ MonoBehaviour: hole8: {fileID: 1695093344} hole9: {fileID: 365973832} mole: {fileID: 1970547168} + timerSpeed: 0 lifeTime: 7.5 + timerlifeTime: 0 moleCanAppear: 0 randomHole: 0 randomHole2: 0 randomHole3: 0 + timer: {fileID: 321956508} --- !u!1 &2067557256 stripped GameObject: m_CorrespondingSourceObject: {fileID: 8559344214941247420, guid: fe1065eaad5f9c14d942a1b50e9353e5, type: 3} @@ -3826,6 +3830,7 @@ MonoBehaviour: scoreText: {fileID: 1889252110} score: 0 moles: {fileID: 0} + movement: {fileID: 1452868882} --- !u!65 &2067557263 BoxCollider: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/BoxTeleport.cs b/Assets/Scripts/BoxTeleport.cs index 7c092d8..4f1a24f 100644 --- a/Assets/Scripts/BoxTeleport.cs +++ b/Assets/Scripts/BoxTeleport.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using TMPro; //* General Comments or Finished Tasks //TODO Tasks left to be done for game @@ -11,20 +12,29 @@ public class BoxTeleport : MonoBehaviour { private GameObject currentContainer; public int waitTime = 3; + public TextMeshProUGUI scoreText; + private int score; + void Start() + { + scoreText.text = "Score: 0"; + } private void OnTriggerEnter(Collider other) { if(other.gameObject.tag == "Container") { currentContainer = other.gameObject; - //* If the box is not the same colour as the container, teleport the box + //* If the box is not the same colour as the container, teleport the box after a few seconds if(currentContainer.gameObject.GetComponentInParent().material.name == gameObject.GetComponent().material.name) { gameObject.transform.position = new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10)); + score =+ 1; + scoreText.text = "Score: " + score; } else { + StartCoroutine(BoxSpawn()); } diff --git a/Assets/Scripts/Colours.cs b/Assets/Scripts/Colours.cs index 9b007aa..bb3b51b 100644 --- a/Assets/Scripts/Colours.cs +++ b/Assets/Scripts/Colours.cs @@ -8,10 +8,7 @@ using UnityEngine; //* General Comments or Finished Tasks //TODO Tasks left to be done for game //! Bugs or Issues -//? Questions or Suggestions - -//TODO As the timer goes down, the containers have a chance to switch renders/colours -//! Somtimes boxes get thrown further than other times. Boxes also sometimes get thrown into random directions. +//? Questions or Suggestions public class Colours : MonoBehaviour { diff --git a/Assets/Scripts/Hamor.cs b/Assets/Scripts/Hamor.cs index 2e97995..162bf90 100644 --- a/Assets/Scripts/Hamor.cs +++ b/Assets/Scripts/Hamor.cs @@ -9,7 +9,7 @@ using UnityEngine; //! Bugs or Issues //? Questions or Suggestions -//TODO Prevent player from moving when they are hitting the moles +//* Prevent player from moving when they are hitting the moles public class Hamor : MonoBehaviour { public Animator hamorAnimator; @@ -19,6 +19,7 @@ public class Hamor : MonoBehaviour public TextMeshProUGUI scoreText; public int score = 0; public Moles_IsHit moles; + public Movement movement; //* Start is called before the first frame update void Start() { @@ -30,10 +31,17 @@ public class Hamor : MonoBehaviour { if(Input.GetMouseButtonDown(0)) { + movement.hammer = true; hamorAnimator.SetTrigger("Bonk"); //* Play the bonk animation + StartCoroutine(MoveTimer()); } } + IEnumerator MoveTimer() + { + yield return new WaitForSeconds(1); + movement.hammer = false; + } IEnumerator BonkTimer() { yield return new WaitForSeconds(1); diff --git a/Assets/Scripts/Moles.cs b/Assets/Scripts/Moles.cs index 51bcfd4..6c1c411 100644 --- a/Assets/Scripts/Moles.cs +++ b/Assets/Scripts/Moles.cs @@ -13,7 +13,6 @@ using UnityEngine; //* As the time goes on, moles appear and disappear faster //* Moles that are hit slowly move down into their hole //TODO Ajust the speed of the moles appearing and disappearing based on the time remaining -//TODO Prevent player from moving when they are hitting the moles public class Moles : MonoBehaviour { diff --git a/Assets/Scripts/Movement.cs b/Assets/Scripts/Movement.cs index 9486ca6..8256bb1 100644 --- a/Assets/Scripts/Movement.cs +++ b/Assets/Scripts/Movement.cs @@ -22,6 +22,7 @@ public class Movement : MonoBehaviour public KeyCode rightKey = KeyCode.D; public KeyCode sprintKey = KeyCode.LeftShift; public KeyCode jumpKey = KeyCode.Space; + public bool hammer = false; void Start() { @@ -34,7 +35,7 @@ public class Movement : MonoBehaviour float backwards = Convert.ToSingle(Input.GetKey(backwardsKey)); float left = Convert.ToSingle(Input.GetKey(leftKey)); float right = Convert.ToSingle(Input.GetKey(rightKey)); - if (controller.isGrounded) + if (controller.isGrounded && !hammer) { moveDirection = new Vector3(right - left, 0, forwards - backwards); //* Change the direction the player is facing based on the direction they are moving @@ -58,6 +59,11 @@ public class Movement : MonoBehaviour } } + if(hammer) + { + moveDirection = Vector3.zero; + } + moveDirection.y -= gravity * Time.deltaTime; controller.Move(moveDirection * Time.deltaTime); } diff --git a/Assets/Scripts/PickUpObject.cs b/Assets/Scripts/PickUpObject.cs index 60bd746..c2cc518 100644 --- a/Assets/Scripts/PickUpObject.cs +++ b/Assets/Scripts/PickUpObject.cs @@ -28,12 +28,6 @@ public class PickUpObject : MonoBehaviour public bool cooldownActive = true; public KeyCode interactKey = KeyCode.F; - // Start is called before the first frame update - void Start() - { - - } - // Update is called once per frame void Update() { diff --git a/Assets/Scripts/Timer.cs b/Assets/Scripts/Timer.cs index 872f0b6..4b44b7c 100644 --- a/Assets/Scripts/Timer.cs +++ b/Assets/Scripts/Timer.cs @@ -13,7 +13,7 @@ public class Timer : MonoBehaviour public float timeRemaining; public TextMeshProUGUI timeText; - //* Universal code for timers + //* Universal game timer void Update() { if (timeRemaining > 0)