Mostly Comments

This commit is contained in:
Santi 2024-06-24 23:53:55 +01:00
parent 170d11aa4d
commit d19aba3a72
9 changed files with 426 additions and 17 deletions

View File

@ -23481,6 +23481,124 @@ Transform:
m_Father: {fileID: 1308571410} m_Father: {fileID: 1308571410}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 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 --- !u!43 &333713881
Mesh: Mesh:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -35488,6 +35606,141 @@ Transform:
m_Father: {fileID: 1308571410} m_Father: {fileID: 1308571410}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 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 --- !u!43 &629826800
Mesh: Mesh:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -36082,6 +36335,7 @@ MonoBehaviour:
rightKey: 101 rightKey: 101
sprintKey: 304 sprintKey: 304
jumpKey: 32 jumpKey: 32
hammer: 0
--- !u!114 &765999536 --- !u!114 &765999536
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -59765,7 +60019,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1123558005} m_GameObject: {fileID: 1123558005}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 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_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -59877,6 +60131,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
waitTime: 3 waitTime: 3
scoreText: {fileID: 2074756335}
--- !u!43 &1255666084 --- !u!43 &1255666084
Mesh: Mesh:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -96058,6 +96313,141 @@ MeshCollider:
m_Convex: 0 m_Convex: 0
m_CookingOptions: 30 m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 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 --- !u!1 &2117739596
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -747,7 +747,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 74dc49a8baecbbb48949a88ac16ad421, type: 3} m_Script: {fileID: 11500000, guid: 74dc49a8baecbbb48949a88ac16ad421, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
timeRemaining: 180 timeRemaining: 120
timeText: {fileID: 169935476} timeText: {fileID: 169935476}
--- !u!1 &365973832 --- !u!1 &365973832
GameObject: GameObject:
@ -1842,6 +1842,7 @@ MonoBehaviour:
rightKey: 101 rightKey: 101
sprintKey: 304 sprintKey: 304
jumpKey: 32 jumpKey: 32
hammer: 0
--- !u!136 &1452868883 --- !u!136 &1452868883
CapsuleCollider: CapsuleCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3771,11 +3772,14 @@ MonoBehaviour:
hole8: {fileID: 1695093344} hole8: {fileID: 1695093344}
hole9: {fileID: 365973832} hole9: {fileID: 365973832}
mole: {fileID: 1970547168} mole: {fileID: 1970547168}
timerSpeed: 0
lifeTime: 7.5 lifeTime: 7.5
timerlifeTime: 0
moleCanAppear: 0 moleCanAppear: 0
randomHole: 0 randomHole: 0
randomHole2: 0 randomHole2: 0
randomHole3: 0 randomHole3: 0
timer: {fileID: 321956508}
--- !u!1 &2067557256 stripped --- !u!1 &2067557256 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 8559344214941247420, guid: fe1065eaad5f9c14d942a1b50e9353e5, type: 3} m_CorrespondingSourceObject: {fileID: 8559344214941247420, guid: fe1065eaad5f9c14d942a1b50e9353e5, type: 3}
@ -3826,6 +3830,7 @@ MonoBehaviour:
scoreText: {fileID: 1889252110} scoreText: {fileID: 1889252110}
score: 0 score: 0
moles: {fileID: 0} moles: {fileID: 0}
movement: {fileID: 1452868882}
--- !u!65 &2067557263 --- !u!65 &2067557263
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using TMPro;
//* General Comments or Finished Tasks //* General Comments or Finished Tasks
//TODO Tasks left to be done for game //TODO Tasks left to be done for game
@ -11,20 +12,29 @@ public class BoxTeleport : MonoBehaviour
{ {
private GameObject currentContainer; private GameObject currentContainer;
public int waitTime = 3; public int waitTime = 3;
public TextMeshProUGUI scoreText;
private int score;
void Start()
{
scoreText.text = "Score: 0";
}
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
if(other.gameObject.tag == "Container") if(other.gameObject.tag == "Container")
{ {
currentContainer = other.gameObject; 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<Renderer>().material.name == gameObject.GetComponent<Renderer>().material.name) if(currentContainer.gameObject.GetComponentInParent<Renderer>().material.name == gameObject.GetComponent<Renderer>().material.name)
{ {
gameObject.transform.position = new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10)); gameObject.transform.position = new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10));
score =+ 1;
scoreText.text = "Score: " + score;
} }
else else
{ {
StartCoroutine(BoxSpawn()); StartCoroutine(BoxSpawn());
} }

View File

@ -10,9 +10,6 @@ using UnityEngine;
//! Bugs or Issues //! Bugs or Issues
//? Questions or Suggestions //? 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.
public class Colours : MonoBehaviour public class Colours : MonoBehaviour
{ {
public GameObject Box; public GameObject Box;

View File

@ -9,7 +9,7 @@ using UnityEngine;
//! Bugs or Issues //! Bugs or Issues
//? Questions or Suggestions //? 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 class Hamor : MonoBehaviour
{ {
public Animator hamorAnimator; public Animator hamorAnimator;
@ -19,6 +19,7 @@ public class Hamor : MonoBehaviour
public TextMeshProUGUI scoreText; public TextMeshProUGUI scoreText;
public int score = 0; public int score = 0;
public Moles_IsHit moles; public Moles_IsHit moles;
public Movement movement;
//* Start is called before the first frame update //* Start is called before the first frame update
void Start() void Start()
{ {
@ -30,10 +31,17 @@ public class Hamor : MonoBehaviour
{ {
if(Input.GetMouseButtonDown(0)) if(Input.GetMouseButtonDown(0))
{ {
movement.hammer = true;
hamorAnimator.SetTrigger("Bonk"); //* Play the bonk animation hamorAnimator.SetTrigger("Bonk"); //* Play the bonk animation
StartCoroutine(MoveTimer());
} }
} }
IEnumerator MoveTimer()
{
yield return new WaitForSeconds(1);
movement.hammer = false;
}
IEnumerator BonkTimer() IEnumerator BonkTimer()
{ {
yield return new WaitForSeconds(1); yield return new WaitForSeconds(1);

View File

@ -13,7 +13,6 @@ using UnityEngine;
//* As the time goes on, moles appear and disappear faster //* As the time goes on, moles appear and disappear faster
//* Moles that are hit slowly move down into their hole //* 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 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 public class Moles : MonoBehaviour
{ {

View File

@ -22,6 +22,7 @@ public class Movement : MonoBehaviour
public KeyCode rightKey = KeyCode.D; public KeyCode rightKey = KeyCode.D;
public KeyCode sprintKey = KeyCode.LeftShift; public KeyCode sprintKey = KeyCode.LeftShift;
public KeyCode jumpKey = KeyCode.Space; public KeyCode jumpKey = KeyCode.Space;
public bool hammer = false;
void Start() void Start()
{ {
@ -34,7 +35,7 @@ public class Movement : MonoBehaviour
float backwards = Convert.ToSingle(Input.GetKey(backwardsKey)); float backwards = Convert.ToSingle(Input.GetKey(backwardsKey));
float left = Convert.ToSingle(Input.GetKey(leftKey)); float left = Convert.ToSingle(Input.GetKey(leftKey));
float right = Convert.ToSingle(Input.GetKey(rightKey)); float right = Convert.ToSingle(Input.GetKey(rightKey));
if (controller.isGrounded) if (controller.isGrounded && !hammer)
{ {
moveDirection = new Vector3(right - left, 0, forwards - backwards); moveDirection = new Vector3(right - left, 0, forwards - backwards);
//* Change the direction the player is facing based on the direction they are moving //* 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; moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime); controller.Move(moveDirection * Time.deltaTime);
} }

View File

@ -28,12 +28,6 @@ public class PickUpObject : MonoBehaviour
public bool cooldownActive = true; public bool cooldownActive = true;
public KeyCode interactKey = KeyCode.F; public KeyCode interactKey = KeyCode.F;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {

View File

@ -13,7 +13,7 @@ public class Timer : MonoBehaviour
public float timeRemaining; public float timeRemaining;
public TextMeshProUGUI timeText; public TextMeshProUGUI timeText;
//* Universal code for timers //* Universal game timer
void Update() void Update()
{ {
if (timeRemaining > 0) if (timeRemaining > 0)