power freeze now works + UI indicator

This commit is contained in:
Novvator 2021-03-13 02:01:20 +00:00
parent 4c689e0561
commit 873c0908ef
17 changed files with 789 additions and 51 deletions

View File

@ -993,6 +993,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1571618361}
m_Modifications:
- target: {fileID: 980120856895548939, guid: d145f0e5906f91a4fad7f384f1b2a6ec, type: 3}
propertyPath: objectTimeScale
value:
objectReference: {fileID: 11400000, guid: 9b68e167db44c0c42837e9a679da964e, type: 2}
- target: {fileID: 8144920974147422729, guid: d145f0e5906f91a4fad7f384f1b2a6ec, type: 3}
propertyPath: m_RootOrder
value: 0
@ -1166,6 +1170,81 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: e20114b5c13a067488940c5cc8e13b60, type: 3}
m_PrefabInstance: {fileID: 3060674079097563415}
m_PrefabAsset: {fileID: 0}
--- !u!1 &355438498
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 355438499}
- component: {fileID: 355438501}
- component: {fileID: 355438500}
m_Layer: 5
m_Name: Cooldown
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &355438499
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 355438498}
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_Children: []
m_Father: {fileID: 1864962002}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -50, y: -50}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &355438500
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 355438498}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.8627451}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: a11777191ca1ac140accf07b15900e79, type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 2
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &355438501
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 355438498}
m_CullTransparentMesh: 1
--- !u!4 &359635900 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: e20114b5c13a067488940c5cc8e13b60, type: 3}
@ -1226,6 +1305,82 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 584f9522dd055c543863c0c60d13776e, type: 3}
m_PrefabInstance: {fileID: 3060674077788289208}
m_PrefabAsset: {fileID: 0}
--- !u!1 &399809200
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 399809201}
- component: {fileID: 399809203}
- component: {fileID: 399809202}
m_Layer: 5
m_Name: PlayerUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &399809201
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 399809200}
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_Children:
- {fileID: 1864962002}
m_Father: {fileID: 2070784762}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &399809202
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 399809200}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &399809203
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 399809200}
m_CullTransparentMesh: 1
--- !u!1 &400420174 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: e20114b5c13a067488940c5cc8e13b60, type: 3}
@ -1284,6 +1439,81 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: e20114b5c13a067488940c5cc8e13b60, type: 3}
m_PrefabInstance: {fileID: 3060674077675415875}
m_PrefabAsset: {fileID: 0}
--- !u!1 &435646862
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 435646863}
- component: {fileID: 435646865}
- component: {fileID: 435646864}
m_Layer: 5
m_Name: FreezePanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &435646863
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 435646862}
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_Children: []
m_Father: {fileID: 2070784762}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &435646864
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 435646862}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.16378963, b: 0.2264151, a: 0.392}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &435646865
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 435646862}
m_CullTransparentMesh: 1
--- !u!4 &437846307 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 2784d88b6334dc143a910f3d252aa5df, type: 3}
@ -1489,7 +1719,7 @@ RectTransform:
- {fileID: 1361646744}
- {fileID: 59318656}
m_Father: {fileID: 2070784762}
m_RootOrder: 0
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@ -2538,11 +2768,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: -0.017264389
value: -0.017264403
objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: 0.009297717
value: 0.009297725
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223329, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_IgnoreTimeScale
@ -2562,19 +2792,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.w
value: 0.9680315
value: 0.96638465
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.x
value: 0.24655113
value: 0.24613166
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: 0.044697873
value: 0.07199832
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: -0.011384248
value: -0.018337488
objectReference: {fileID: 0}
- target: {fileID: 4676633831414007564, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_Name
@ -2688,6 +2918,22 @@ PrefabInstance:
propertyPath: m_ActionEvents.Array.data[5].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
- target: {fileID: 4676633831945762666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: frozenTime
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4676633831945762666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: FreezePanel
value:
objectReference: {fileID: 435646862}
- target: {fileID: 4676633831945762666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: cooldownImage
value:
objectReference: {fileID: 355438500}
- target: {fileID: 4676633831945762666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: objectTimeScale
value:
objectReference: {fileID: 11400000, guid: 9b68e167db44c0c42837e9a679da964e, type: 2}
- target: {fileID: 4676633831945762666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: playerTimeScale
value:
@ -2726,11 +2972,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: -0.017264403
value: -0.017264389
objectReference: {fileID: 0}
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: 0.009297725
value: 0.009297717
objectReference: {fileID: 0}
- target: {fileID: 4676633832858914730, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_XAxis.m_InvertInput
@ -2766,19 +3012,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.w
value: 0.9996367
value: 0.99849
objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.x
value: 0.0047710985
value: 0.0047656447
objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: 0.023356276
value: 0.048184585
objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: -0.012578499
value: -0.025949758
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
@ -3374,7 +3620,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5119468870989674483, guid: fde30a46065b3b144ac612ec0b3e484a, type: 3}
propertyPath: m_RootOrder
value: 1
value: 4
objectReference: {fileID: 0}
- target: {fileID: 5119468870989674483, guid: fde30a46065b3b144ac612ec0b3e484a, type: 3}
propertyPath: m_AnchorMax.x
@ -4837,7 +5083,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8951021900398560347, guid: 8b2275700cf2cc5448873b7f1aa592b6, type: 3}
propertyPath: m_RootOrder
value: 2
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8951021900398560347, guid: 8b2275700cf2cc5448873b7f1aa592b6, type: 3}
propertyPath: m_AnchorMax.x
@ -5479,6 +5725,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1571618361}
m_Modifications:
- target: {fileID: 980120856895548939, guid: d145f0e5906f91a4fad7f384f1b2a6ec, type: 3}
propertyPath: objectTimeScale
value:
objectReference: {fileID: 11400000, guid: 9b68e167db44c0c42837e9a679da964e, type: 2}
- target: {fileID: 8144920974147422729, guid: d145f0e5906f91a4fad7f384f1b2a6ec, type: 3}
propertyPath: m_RootOrder
value: 1
@ -6818,6 +7068,82 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: e20114b5c13a067488940c5cc8e13b60, type: 3}
m_PrefabInstance: {fileID: 3060674077618818203}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1864962001
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1864962002}
- component: {fileID: 1864962004}
- component: {fileID: 1864962003}
m_Layer: 5
m_Name: Hourglass
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1864962002
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1864962001}
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_Children:
- {fileID: 355438499}
m_Father: {fileID: 399809201}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -80, y: -78}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1864962003
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1864962001}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 21300000, guid: aaef6bac05ac36e48ade031f9a4230be, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1864962004
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1864962001}
m_CullTransparentMesh: 1
--- !u!1 &1865590810 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 4a31c57c3ca869448a5849436b526efa, type: 3}
@ -7439,7 +7765,6 @@ MonoBehaviour:
inputSettings: {fileID: 11400000, guid: 87faf39b6f22e524984c1680a88045ac, type: 2}
dialogue: {fileID: 11400000, guid: 56369c4e83cc59e44bf55cd16fafc4e8, type: 2}
artefacts: {fileID: 11400000, guid: f523ac0d77530064b8b41c627b13fae0, type: 2}
playerTimeScale: {fileID: 11400000, guid: 39c05ba9d0743074b9eb0e561ba1fcb8, type: 2}
--- !u!114 &2070784759
MonoBehaviour:
m_ObjectHideFlags: 0
@ -7512,9 +7837,11 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 435646863}
- {fileID: 399809201}
- {fileID: 483749938}
- {fileID: 982982466}
- {fileID: 1356834191}
- {fileID: 982982466}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -16,7 +16,6 @@ public class PickUpDisplay : MonoBehaviour
[SerializeField] private InputSettings inputSettings;
[SerializeField] private DialogueSystem dialogue;
[SerializeField] private ArtefactSystem artefacts;
[SerializeField] private SerialFloat playerTimeScale;
private Artefact chosenArtefact;
@ -36,24 +35,22 @@ public class PickUpDisplay : MonoBehaviour
public void PopUpOn()
{
_paused = true;
//artefactUI.SetActive(true);
//Player.GetComponent<PlayerInput>().enabled = false;
artefactUI.SetActive(true);
Player.GetComponent<PlayerInput>().enabled = false;
artefactText.text = "You have unlocked " + chosenArtefact.Name + "!";
//inputSettings.updateMode = (InputSettings.UpdateMode)1;
inputSettings.updateMode = (InputSettings.UpdateMode)1;
Time.timeScale = 0f;
//playerTimeScale.Value = 0f;
}
public void PopUpOff()
{
_paused = false;
//artefactUI.SetActive(false);
//inputSettings.updateMode = (InputSettings.UpdateMode)2;
//Player.GetComponent<PlayerInput>().enabled = true;
artefactUI.SetActive(false);
inputSettings.updateMode = (InputSettings.UpdateMode)2;
Player.GetComponent<PlayerInput>().enabled = true;
Time.timeScale = 1.0f;
//playerTimeScale.Value = 1.0f;
//dialogue.PlayLine(chosenArtefact.dialogueKey);
dialogue.PlayLine(chosenArtefact.dialogueKey);
chosenArtefact = null;
}
}

View File

@ -2,6 +2,8 @@ using Extensions;
using UnityEngine;
using NaughtyAttributes;
using Ktyl.Util;
using System.Collections;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour
{
@ -69,9 +71,22 @@ public class PlayerController : MonoBehaviour
private const float TAU = Mathf.PI * 2f;
private const float HALF_PI = Mathf.PI / 2f;
private float timeSinceStop;
[Header("Power Freeze")]
[SerializeField]
private SerialFloat objectTimeScale;
[SerializeField]
private SerialFloat playerTimeScale;
private float frozenTime;
[SerializeField]
private GameObject FreezePanel;
[SerializeField]
private Image cooldownImage;
private float cooldownTimer = 0f;
private enum JumpState
{
@ -155,15 +170,41 @@ public class PlayerController : MonoBehaviour
}
/*private void UpdateFreeze( float dt)
private void UpdateFreeze( float dt)
{
if( _powers.Freeze.CanConsume )
updateCooldownUI(_powers.Freeze.cooldown, _powers.Freeze.regenerateTime);
if ( _powers.Freeze.CanConsume && _inputHandler.InputState.Freeze.GetRawValue() )
{
Time.timeScale = 0f;
_powers.Freeze.Consume();
objectTimeScale.Value = 0f;
FreezePanel.SetActive(true);
}
if (_powers.Freeze.timeSinceConsume > frozenTime)
{
UnfreezeTime();
}
}
*/
private void UnfreezeTime()
{
FreezePanel.SetActive(false);
objectTimeScale.Value = 1f;
}
public void updateCooldownUI(float rawCooldownTimer, float regenerateTime)
{
if (rawCooldownTimer <= 0)
cooldownTimer = 0;
else
cooldownTimer = rawCooldownTimer / regenerateTime;
cooldownImage.fillAmount = cooldownTimer;
}
private void UpdateJump(float dt)
{
@ -273,7 +314,7 @@ public class PlayerController : MonoBehaviour
private void FixedUpdate()
{
float dt = Time.fixedUnscaledDeltaTime * playerTimeScale;
float dt = Time.fixedDeltaTime;
_overrideDelta = Vector2.zero;
@ -289,7 +330,7 @@ public class PlayerController : MonoBehaviour
UpdateJump( dt );
UpdateLook( dt );
UpdateBlink( dt );
//UpdateFreeze( dt );
UpdateFreeze( dt );
UpdateGravity( dt );
UpdateDrag( dt );
UpdateMovement( dt );

View File

@ -16,9 +16,6 @@ public class PlayerInputHandler : MonoBehaviour
[SerializeField]
private Camera _camera;
[SerializeField]
private SerialFloat playerTimeScale;
public class PlayerInputState
{
public BufferedInput Jump;

View File

@ -7,26 +7,34 @@ using UnityEngine.Events;
[CreateAssetMenu(menuName = "KernelPanic/Player/Power", fileName = "PlayerPower.asset")]
public class PlayerPower : ScriptableObject
{
[SerializeField]
private bool _regenerateOnGround;
[SerializeField]
private bool _regenerateInAir;
[SerializeField]
private float _regenerateTime;
public float regenerateTime => _regenerateTime;
[SerializeField] private float _regenerateTime;
private bool _unlocked;
private bool _cheated;
private bool _consumed;
private float _timeSinceConsume;
public float cooldown => _cooldown;
private float _cooldown;
public float timeSinceConsume => _timeSinceConsume;
public float _timeSinceConsume;
private UnityEvent _onUnlock = new UnityEvent();
public UnityEvent OnUnlock => _onUnlock;
public void UpdatePower( float deltaTime, bool cheat, bool grounded)
{
_cheated = cheat;
bool regenerate = grounded ? _regenerateOnGround : _regenerateInAir;
@ -34,9 +42,11 @@ public class PlayerPower : ScriptableObject
if ( _consumed && regenerate )
{
_timeSinceConsume += deltaTime;
_cooldown = _regenerateTime - timeSinceConsume;
if ( _timeSinceConsume > _regenerateTime )
{
this.Reset();
}
}

View File

@ -1,3 +1,4 @@
using Ktyl.Util;
using System;
using System.Collections;
using System.Collections.Generic;
@ -14,6 +15,7 @@ public class FallawayFloor : MonoBehaviour
public Material dissolve;
[SerializeField] private Renderer _renderer;
[SerializeField] private SerialFloat objectTimeScale;
Rigidbody rb;
@ -28,8 +30,27 @@ public class FallawayFloor : MonoBehaviour
if (other.CompareTag("Player"))
{
// Start the Destroy floor coroutine and switch to the dissolve material.
StartCoroutine(DestroyFloor());
_renderer.material = dissolve;
if (objectTimeScale != 0)
{
StartCoroutine(DestroyFloor());
_renderer.material = dissolve;
}
}
}
//The platform gets destroyed after the player resumes frozen time on a platform
private void OnTriggerStay(Collider other)
{
if (other.CompareTag("Player"))
{
// Start the Destroy floor coroutine and switch to the dissolve material.
if (objectTimeScale != 0)
{
StartCoroutine(DestroyFloor());
_renderer.material = dissolve;
}
}
}

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76553ada4233edc458c3fed9b69e128f, type: 3}
m_Name: playerTimeScale
m_Name: objectTimeScale
m_EditorClassIdentifier:
_initialValue: 1
_readOnly: 0

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 39c05ba9d0743074b9eb0e561ba1fcb8
guid: 9b68e167db44c0c42837e9a679da964e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

View File

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerUI : MonoBehaviour
{
[SerializeField]
private Image cooldownImage;
private float cooldownTimer = 0f;
public void updateCooldownUI(float rawCooldownTimer, float regenerateTime)
{
if (rawCooldownTimer <= 0)
cooldownTimer = 0;
else
cooldownTimer = Mathf.Round(rawCooldownTimer) / regenerateTime;
cooldownImage.fillAmount = cooldownTimer;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7befeb001df190b4b8ff21ffa8aa3eec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,6 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 24d28ac60e22b5547b2beb8679625039, type: 3}
m_Name: Freeze
m_EditorClassIdentifier:
_regenerateOnGround: 0
_regenerateInAir: 0
_regenerateTime: 0
_regenerateOnGround: 1
_regenerateInAir: 1
_regenerateTime: 7
_timeSinceConsume: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 19008748323c67c42ba1b644df014f55
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 094334fe2c676634a87026c228e6aeeb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/UI/PlayerUI/Cooldown/3702524 1.jpg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,144 @@
fileFormatVersion: 2
guid: a11777191ca1ac140accf07b15900e79
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 2
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,144 @@
fileFormatVersion: 2
guid: aaef6bac05ac36e48ade031f9a4230be
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 2
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: