Keep Away logic finalized and UI polished up
One animation bug found when player picks up hat (possibly when jumping)
This commit is contained in:
@@ -232,6 +232,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8934960097828904141}
|
||||
- {fileID: 4682083114220027504}
|
||||
m_Father: {fileID: 7676803003410367555}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@@ -1146,7 +1147,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
playersParent: {fileID: 988306558956667265}
|
||||
playerPrefab: {fileID: 6050315616127366206, guid: 9d1aea173ff7d4db782e85393dccab09, type: 3}
|
||||
lifePrefab: {fileID: 367874778634194597, guid: d9a95e84f7261408c84253a380f8af08, type: 3}
|
||||
leaderboardIconPrefab: {fileID: 0}
|
||||
--- !u!114 &7919281515446387900
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1159,6 +1160,142 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 34a52816a1c62984ea622bbf50849c68, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &5966626591467413986
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4682083114220027504}
|
||||
- component: {fileID: 2357798593447460624}
|
||||
- component: {fileID: 1044159204125992194}
|
||||
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 &4682083114220027504
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5966626591467413986}
|
||||
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: 1099378058920397299}
|
||||
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: 0, y: 0}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2357798593447460624
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5966626591467413986}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1044159204125992194
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5966626591467413986}
|
||||
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: New Text
|
||||
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_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 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!1 &6899563759788244456
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1344,7 +1481,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: d6e4006937b044c9ab3de25a7ab68162, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
maxLives: 3
|
||||
time: 180
|
||||
offset: 1
|
||||
gameOver: 0
|
||||
|
||||
@@ -28,6 +28,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 7129295199235698338}
|
||||
- {fileID: 1907008449299828318}
|
||||
- {fileID: 8618986451393531304}
|
||||
- {fileID: 8769608972973537434}
|
||||
@@ -113,6 +114,142 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &5249190027099290974
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7129295199235698338}
|
||||
- component: {fileID: 537544580200389647}
|
||||
- component: {fileID: 8725186521474680087}
|
||||
m_Layer: 5
|
||||
m_Name: Position Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7129295199235698338
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5249190027099290974}
|
||||
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: 3130525157782964738}
|
||||
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: -52, y: -2.3}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &537544580200389647
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5249190027099290974}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &8725186521474680087
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5249190027099290974}
|
||||
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: '#1'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: f4b6d771d01664138b2f3db447b45695, type: 2}
|
||||
m_sharedMaterial: {fileID: 560944918044722035, guid: f4b6d771d01664138b2f3db447b45695, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4278190080
|
||||
m_fontColor: {r: 0, g: 0, b: 0, 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: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 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!1 &5607506374165540699
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -4809,10 +4809,78 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_text
|
||||
value: Time left!
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_fontSize
|
||||
value: 24
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_margin.x
|
||||
value: -1.3713989
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_margin.z
|
||||
value: -11.657684
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_fontAsset
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: f4b6d771d01664138b2f3db447b45695, type: 2}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_fontColor.b
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_fontColor.g
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_fontColor.r
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_fontSizeBase
|
||||
value: 24
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_sharedMaterial
|
||||
value:
|
||||
objectReference: {fileID: 560944918044722035, guid: f4b6d771d01664138b2f3db447b45695, type: 2}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_fontColor32.rgba
|
||||
value: 4278190080
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1044159204125992194, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_hasFontAssetChanged
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2396754106601062846, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: time
|
||||
value: 180
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2396754106601062846, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: hatObject
|
||||
value:
|
||||
objectReference: {fileID: 444980832}
|
||||
- target: {fileID: 2396754106601062846, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: TimerCanvas
|
||||
value:
|
||||
objectReference: {fileID: 6442071445436727404}
|
||||
- target: {fileID: 2396754106601062846, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: LeaderboardCanvas
|
||||
value:
|
||||
objectReference: {fileID: 6442071445436727405}
|
||||
- target: {fileID: 3636379526195672734, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_text
|
||||
value: 3:00
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3636379526195672734, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_margin.w
|
||||
value: 1357.2593
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3636379526195672734, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_fontAsset
|
||||
value:
|
||||
@@ -4837,6 +4905,14 @@ PrefabInstance:
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0.25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4682083114220027504, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: -298.4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4682083114220027504, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 117.3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4832072825095962115, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: timer
|
||||
value:
|
||||
@@ -4867,11 +4943,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7676803003410367555, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 29
|
||||
value: -5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7676803003410367555, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 12.75
|
||||
value: -231
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7676803003410367555, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
@@ -4913,6 +4989,14 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: HealthCanvas
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8934960097828904141, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 218
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8934960097828904141, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -791
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects:
|
||||
- {fileID: 4148327129846918965, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
@@ -4930,6 +5014,16 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!223 &6442071445436727404 stripped
|
||||
Canvas:
|
||||
m_CorrespondingSourceObject: {fileID: 2989920920269489744, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
m_PrefabInstance: {fileID: 6442071445436727402}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!223 &6442071445436727405 stripped
|
||||
Canvas:
|
||||
m_CorrespondingSourceObject: {fileID: 7061268803878077000, guid: e3c570bb90d434e809aca2a339dadf5d, type: 3}
|
||||
m_PrefabInstance: {fileID: 6442071445436727402}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &8682934954266721942
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -21,6 +21,9 @@ public class GameManager : MonoBehaviour
|
||||
public static string map = "Platformer With Headroom"; // loads a default map as a safety net
|
||||
public Vector2 spawnPosition;
|
||||
public Vector2 hatSpawnPosition;
|
||||
public Canvas LeaderboardCanvas;
|
||||
public Canvas TimerCanvas;
|
||||
public GameObject hatObject;
|
||||
public enum GameMode
|
||||
{
|
||||
freeForAll,
|
||||
@@ -48,6 +51,8 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
private void Update() // Continuously updates player hold times
|
||||
{
|
||||
if (gameOver) return;
|
||||
|
||||
foreach (var player in players)
|
||||
{
|
||||
float holdTime = GetPlayerHoldTime(player);
|
||||
@@ -101,6 +106,12 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
public void PlayerDied(Damageable player) // Handles player deaths for the respective gamemode
|
||||
{
|
||||
UseItem useItem = player.GetComponent<UseItem>(); // Drop the item the player is holding
|
||||
if (useItem != null)
|
||||
{
|
||||
useItem.DropItem();
|
||||
}
|
||||
|
||||
if (gameMode == GameMode.freeForAll) // Respawns player if they have lives left
|
||||
{
|
||||
player.lives--;
|
||||
@@ -127,6 +138,7 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void RespawnPlayer(GameObject player) // Respawns player at the spawn point and resets health
|
||||
{
|
||||
RespawnOnTriggerEnter respawnScript = player.GetComponent<RespawnOnTriggerEnter>();
|
||||
@@ -142,6 +154,10 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
gameOver = true;
|
||||
EndGameEvent?.Invoke();
|
||||
LeaderboardCanvas.gameObject.SetActive(false);
|
||||
TimerCanvas.gameObject.SetActive(false);
|
||||
hatObject.SetActive(false);
|
||||
|
||||
if (gameMode == GameMode.freeForAll) // Last player alive wins
|
||||
{
|
||||
GameObject winner = AlivePlayers()[0];
|
||||
@@ -184,7 +200,7 @@ public class GameManager : MonoBehaviour
|
||||
return alivePlayers;
|
||||
}
|
||||
|
||||
public void UpdatePlayerHoldTime(GameObject player, float holdTime)
|
||||
public void UpdatePlayerHoldTime(GameObject player, float holdTime) // Updates the player's hold time and leaderboard
|
||||
{
|
||||
bool shouldSort = false;
|
||||
|
||||
@@ -201,11 +217,7 @@ public class GameManager : MonoBehaviour
|
||||
playerHoldTimes.Add(player, holdTime);
|
||||
shouldSort = true;
|
||||
}
|
||||
|
||||
// Update the player's hold time text
|
||||
LeaderboardManager.Instance.UpdatePlayerHoldTimeText(player, holdTime);
|
||||
|
||||
// Sort the leaderboard if necessary
|
||||
if (shouldSort)
|
||||
{
|
||||
LeaderboardManager.Instance.UpdateLeaderboard();
|
||||
|
||||
@@ -2,13 +2,50 @@ using UnityEngine;
|
||||
|
||||
public class HatRespawn : MonoBehaviour
|
||||
{
|
||||
void OnTriggerEnter2D(Collider2D collision) // Respawns the hat to the hat spawn position if it falls out of bounds
|
||||
private float lastInteractionTime;
|
||||
private const float respawnTime = 10f;
|
||||
private bool isDropped;
|
||||
|
||||
void Start()
|
||||
{
|
||||
lastInteractionTime = Time.time;
|
||||
isDropped = false;
|
||||
}
|
||||
|
||||
void Update() // Checks if the hat has been inactive for too long
|
||||
{
|
||||
if (isDropped && Time.time - lastInteractionTime > respawnTime)
|
||||
{
|
||||
RespawnHat();
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D collision) // Respawns the hat if it falls out of bounds
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Platformer Hazard"))
|
||||
{
|
||||
RespawnHat();
|
||||
}
|
||||
}
|
||||
|
||||
public void Interact() // Updates the player interaction time
|
||||
{
|
||||
lastInteractionTime = Time.time;
|
||||
isDropped = false;
|
||||
}
|
||||
|
||||
public void OnHatDropped() // Resets the timer when the hat is dropped
|
||||
{
|
||||
lastInteractionTime = Time.time;
|
||||
isDropped = true;
|
||||
}
|
||||
|
||||
private void RespawnHat() // Respawns the hat at the designated spawn position
|
||||
{
|
||||
transform.position = GameManager.Instance.hatSpawnPosition;
|
||||
GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
|
||||
transform.rotation = Quaternion.identity;
|
||||
}
|
||||
lastInteractionTime = Time.time; // Reset the timer after respawning
|
||||
isDropped = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class LeaderboardManager : MonoBehaviour
|
||||
private void InitializeLeaderboard() // Creates the leaderboard icons for each player
|
||||
{
|
||||
RectTransform parentRectTransform = playersParent.GetComponent<RectTransform>();
|
||||
parentRectTransform.anchoredPosition = new Vector2(-20f, 10f);
|
||||
parentRectTransform.anchoredPosition = new Vector2(-10f, 10f);
|
||||
|
||||
foreach (GameObject player in GameManager.players)
|
||||
{
|
||||
@@ -44,27 +44,45 @@ public class LeaderboardManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateLeaderboard() // Sorts the leaderboard based on player hold times
|
||||
public void UpdateLeaderboard()
|
||||
{
|
||||
List<KeyValuePair<GameObject, float>> sortedList = new List<KeyValuePair<GameObject, float>>(GameManager.playerHoldTimes);
|
||||
sortedList.Sort((pair1, pair2) => pair2.Value.CompareTo(pair1.Value));
|
||||
foreach (var player in sortedList)
|
||||
|
||||
for (int i = 0; i < sortedList.Count; i++)
|
||||
{
|
||||
playerIcons[player.Key].transform.SetSiblingIndex(sortedList.IndexOf(player));
|
||||
var player = sortedList[i];
|
||||
playerIcons[player.Key].transform.SetSiblingIndex(i);
|
||||
|
||||
// Update the number text
|
||||
TextMeshProUGUI[] textComponents = playerIcons[player.Key].GetComponentsInChildren<TextMeshProUGUI>();
|
||||
foreach (var textComponent in textComponents)
|
||||
{
|
||||
if (textComponent.name == "Position Text")
|
||||
{
|
||||
textComponent.text = "#" + (i + 1).ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePlayerHoldTimeText(GameObject player, float holdTime) // Updates the hold times of each player shown on the leaderboard
|
||||
public void UpdatePlayerHoldTimeText(GameObject player, float holdTime)
|
||||
{
|
||||
if (playerIcons.ContainsKey(player))
|
||||
{
|
||||
TextMeshProUGUI holdTimeText = playerIcons[player].GetComponentInChildren<TextMeshProUGUI>();
|
||||
if (holdTimeText != null)
|
||||
TextMeshProUGUI[] textComponents = playerIcons[player].GetComponentsInChildren<TextMeshProUGUI>();
|
||||
foreach (var textComponent in textComponents)
|
||||
{
|
||||
if (textComponent.name == "Text (TMP)")
|
||||
{
|
||||
int minutes = Mathf.FloorToInt(holdTime / 60F);
|
||||
int seconds = Mathf.FloorToInt(holdTime % 60F);
|
||||
holdTimeText.text = string.Format("{0:0}:{1:00}", minutes, seconds);
|
||||
textComponent.text = string.Format("{0:0}:{1:00}", minutes, seconds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,12 +96,17 @@ public class Damageable : MonoBehaviour
|
||||
{
|
||||
if (GameManager.Instance != null)
|
||||
{
|
||||
GetComponent<UseItem>().DropItem();
|
||||
UseItem useItem = GetComponent<UseItem>();
|
||||
if (useItem != null)
|
||||
{
|
||||
useItem.DropItem(); // Ensure the player drops the item before the death animation
|
||||
}
|
||||
animator.SetBool("die", true);
|
||||
dying = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void HandleDeath() // Removes player from dying state after respawn
|
||||
{
|
||||
GameManager.Instance.PlayerDied(this);
|
||||
|
||||
@@ -7,6 +7,12 @@ public class UseItem : MonoBehaviour
|
||||
private bool isHoldingItem = false;
|
||||
private float holdStartTime;
|
||||
public float holdTime;
|
||||
private Damageable damageable;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
damageable = GetComponent<Damageable>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
@@ -25,7 +31,7 @@ public class UseItem : MonoBehaviour
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D collision) // Player automatically picks up hat when touching it
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Hat") && !isHoldingItem)
|
||||
if (collision.gameObject.CompareTag("Hat") && !isHoldingItem && !damageable.dying)
|
||||
{
|
||||
PickUpItem(collision.gameObject);
|
||||
}
|
||||
@@ -33,12 +39,15 @@ public class UseItem : MonoBehaviour
|
||||
|
||||
private void PickUpItem(GameObject item) // Player picks up hat and starts hold counter
|
||||
{
|
||||
if (damageable.dying) return; // Prevent picking up items if the player is dying
|
||||
|
||||
heldItem = item;
|
||||
isHoldingItem = true;
|
||||
holdStartTime = Time.time;
|
||||
item.GetComponent<Collider2D>().enabled = false;
|
||||
item.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Static;
|
||||
item.transform.rotation = Quaternion.identity;
|
||||
item.GetComponent<HatRespawn>().Interact();
|
||||
if (!GameManager.playerHoldTimes.ContainsKey(gameObject))
|
||||
{
|
||||
GameManager.playerHoldTimes[gameObject] = 0f;
|
||||
|
||||
Reference in New Issue
Block a user