Merge branch '14-power_freeze' into 'main'

Resolve "glove: freeze"

See merge request kernel-panic/revival!47
This commit is contained in:
Cinder Foster-Smith 2021-03-24 12:54:04 +00:00
commit cfa6ac4027
29 changed files with 959 additions and 15 deletions

View File

@ -0,0 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0228856d50ce2a845abd7b3eda114390, type: 3}
m_Name: PA_Freeze
m_EditorClassIdentifier:
_artefactID: 12
_dialogueKey:
_name: Freeze
_power: {fileID: 0}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c2e37ff6639a22e4eacc5e95d8e13723
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -167,6 +167,8 @@ MonoBehaviour:
_jumpColor: {r: 1, g: 0.95084643, b: 0, a: 0} _jumpColor: {r: 1, g: 0.95084643, b: 0, a: 0}
_boostColor: {r: 1, g: 0, b: 0.9173207, a: 0} _boostColor: {r: 1, g: 0, b: 0.9173207, a: 0}
_exhaustedColor: {r: 1, g: 0, b: 0, a: 0} _exhaustedColor: {r: 1, g: 0, b: 0, a: 0}
objectTimeScale: {fileID: 11400000, guid: 9b68e167db44c0c42837e9a679da964e, type: 2}
frozenTime: {fileID: 11400000, guid: 19273ba4ac237ab4381926cfb195dda8, type: 2}
--- !u!114 &13726836969441780 --- !u!114 &13726836969441780
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -297,6 +299,10 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_ActionId: b118302a-6162-4223-8a6c-38ff2d6b4133 m_ActionId: b118302a-6162-4223-8a6c-38ff2d6b4133
m_ActionName: ArtefactPreview/LookDelta[/Mouse/delta] m_ActionName: ArtefactPreview/LookDelta[/Mouse/delta]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 29f1599e-fe43-47df-ad25-8e712263d0ab
m_ActionName: CoreMap/Freeze[/Keyboard/g]
m_NeverAutoSwitchControlSchemes: 0 m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme: Gamepad m_DefaultControlScheme: Gamepad
m_DefaultActionMap: CoreMap m_DefaultActionMap: CoreMap
@ -332,8 +338,10 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_cheatBlink: 0 _cheatBlink: 0
_cheatBoost: 0 _cheatBoost: 0
_cheatFreeze: 0
_blink: {fileID: 11400000, guid: b47ea197a7cc2ed4eb15271cef672997, type: 2} _blink: {fileID: 11400000, guid: b47ea197a7cc2ed4eb15271cef672997, type: 2}
_boost: {fileID: 11400000, guid: d5ed942937d8cca478f3ec97f6b9c8a2, type: 2} _boost: {fileID: 11400000, guid: d5ed942937d8cca478f3ec97f6b9c8a2, type: 2}
_freeze: {fileID: 0}
--- !u!114 &3320306143821152633 --- !u!114 &3320306143821152633
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -318,6 +318,18 @@ PrefabInstance:
propertyPath: m_Camera propertyPath: m_Camera
value: value:
objectReference: {fileID: 4676633831388223340} objectReference: {fileID: 4676633831388223340}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[5].m_ActionId
value: 0eb55067-1328-4b0a-9494-b427befe049a
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[5].m_ActionName
value: CoreMap/New action
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[5].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: Blink
objectReference: {fileID: 0}
- target: {fileID: 13726836969441781, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} - target: {fileID: 13726836969441781, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Player value: Player
@ -326,6 +338,10 @@ PrefabInstance:
propertyPath: _camera propertyPath: _camera
value: value:
objectReference: {fileID: 4676633831388223340} objectReference: {fileID: 4676633831388223340}
- target: {fileID: 13726837176080779, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: _freeze
value:
objectReference: {fileID: 11400000, guid: 0cd9cf6494bb6f54d9b97631010d780e, type: 2}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
--- !u!4 &4676633831945762709 stripped --- !u!4 &4676633831945762709 stripped

View File

@ -87,6 +87,7 @@ MonoBehaviour:
fallAwayTime: 1 fallAwayTime: 1
dissolve: {fileID: 2100000, guid: 98767dd77414bad44b23ef5332c1d8f1, type: 2} dissolve: {fileID: 2100000, guid: 98767dd77414bad44b23ef5332c1d8f1, type: 2}
_renderer: {fileID: 6378198502367496824} _renderer: {fileID: 6378198502367496824}
objectTimeScale: {fileID: 11400000, guid: 9b68e167db44c0c42837e9a679da964e, type: 2}
_settings: {fileID: 11400000, guid: 36275776eda5c8249bf45e01721afe36, type: 2} _settings: {fileID: 11400000, guid: 36275776eda5c8249bf45e01721afe36, type: 2}
_graphics: {fileID: 4864755999650917293} _graphics: {fileID: 4864755999650917293}
--- !u!54 &980120856895548943 --- !u!54 &980120856895548943

View File

@ -0,0 +1,322 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2220041284483646358
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2220041284483646359}
- component: {fileID: 2220041284483646357}
- component: {fileID: 2220041284483646356}
- component: {fileID: 2220041284483646354}
m_Layer: 5
m_Name: PlayerUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2220041284483646359
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284483646358}
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: 2220041284586465449}
- {fileID: 2220041284891186932}
m_Father: {fileID: 0}
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!222 &2220041284483646357
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284483646358}
m_CullTransparentMesh: 1
--- !u!114 &2220041284483646356
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284483646358}
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!114 &2220041284483646354
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284483646358}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7befeb001df190b4b8ff21ffa8aa3eec, type: 3}
m_Name:
m_EditorClassIdentifier:
cooldownImage: {fileID: 2220041284521989762}
freeze: {fileID: 11400000, guid: 0cd9cf6494bb6f54d9b97631010d780e, type: 2}
freezePanel: {fileID: 2220041284586465448}
frozenTime: {fileID: 11400000, guid: 19273ba4ac237ab4381926cfb195dda8, type: 2}
--- !u!1 &2220041284521989764
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2220041284521989765}
- component: {fileID: 2220041284521989763}
- component: {fileID: 2220041284521989762}
m_Layer: 5
m_Name: Cooldown
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2220041284521989765
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284521989764}
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: 2220041284891186932}
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!222 &2220041284521989763
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284521989764}
m_CullTransparentMesh: 1
--- !u!114 &2220041284521989762
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284521989764}
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!1 &2220041284586465448
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2220041284586465449}
- component: {fileID: 2220041284586465463}
- component: {fileID: 2220041284586465462}
m_Layer: 5
m_Name: FreezePanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &2220041284586465449
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284586465448}
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: 2220041284483646359}
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!222 &2220041284586465463
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284586465448}
m_CullTransparentMesh: 1
--- !u!114 &2220041284586465462
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284586465448}
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!1 &2220041284891186935
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2220041284891186932}
- component: {fileID: 2220041284891186930}
- component: {fileID: 2220041284891186933}
m_Layer: 5
m_Name: Hourglass
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2220041284891186932
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284891186935}
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: 2220041284521989765}
m_Father: {fileID: 2220041284483646359}
m_RootOrder: 1
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!222 &2220041284891186930
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284891186935}
m_CullTransparentMesh: 1
--- !u!114 &2220041284891186933
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2220041284891186935}
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

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9cd4e8a96e33818468d6db4407b760e3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,9 @@
using Extensions; using Extensions;
using UnityEngine; using UnityEngine;
using NaughtyAttributes; using NaughtyAttributes;
using Ktyl.Util;
using System.Collections;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour public class PlayerController : MonoBehaviour
{ {
@ -71,6 +74,15 @@ public class PlayerController : MonoBehaviour
private const float TAU = Mathf.PI * 2f; private const float TAU = Mathf.PI * 2f;
private const float HALF_PI = Mathf.PI / 2f; private const float HALF_PI = Mathf.PI / 2f;
private float timeSinceStop;
[Header("Power Freeze")]
[SerializeField]
private SerialFloat objectTimeScale;
[SerializeField]
private SerialFloat frozenTime;
private enum JumpState private enum JumpState
{ {
None, None,
@ -152,6 +164,33 @@ public class PlayerController : MonoBehaviour
} }
} }
private void UpdateFreeze( float dt)
{
if ( _powers.Freeze.CanConsume && _inputHandler.InputState.Freeze.GetRawValue() )
{
_powers.Freeze.Consume();
objectTimeScale.Value = 0f;
}
if (_powers.Freeze.timeSinceConsume > frozenTime)
{
UnfreezeTime();
}
}
private void UnfreezeTime()
{
objectTimeScale.Value = 1f;
}
private void FreezeReset()
{
_powers.Freeze.Reset();
}
private void UpdateJump(float dt) private void UpdateJump(float dt)
{ {
_fallTime = _grounded ? 0f : (_fallTime + dt); _fallTime = _grounded ? 0f : (_fallTime + dt);
@ -287,6 +326,7 @@ public class PlayerController : MonoBehaviour
UpdateJump( dt ); UpdateJump( dt );
UpdateLook( dt ); UpdateLook( dt );
UpdateBlink( dt ); UpdateBlink( dt );
UpdateFreeze( dt );
UpdateGravity( dt ); UpdateGravity( dt );
UpdateDrag( dt ); UpdateDrag( dt );
UpdateMovement( dt ); UpdateMovement( dt );

View File

@ -24,15 +24,17 @@ public class PlayerInputHandler : MonoBehaviour
public BufferedInput Jump; public BufferedInput Jump;
public BufferedInput Blink; public BufferedInput Blink;
public BufferedInput Use; public BufferedInput Use;
public BufferedInput Freeze;
public CameraRelativeInput Move; public CameraRelativeInput Move;
public Vector2 Look; public Vector2 Look;
public float MoveRotation; public float MoveRotation;
public PlayerInputState( float jumpBuffer, float blinkBuffer, float useBuffer ) public PlayerInputState( float jumpBuffer, float blinkBuffer, float useBuffer , float freezeBuffer)
{ {
Jump = new BufferedInput( jumpBuffer ); Jump = new BufferedInput( jumpBuffer );
Blink = new BufferedInput( blinkBuffer ); Blink = new BufferedInput( blinkBuffer );
Use = new BufferedInput( useBuffer ); Use = new BufferedInput( useBuffer );
Freeze = new BufferedInput( freezeBuffer );
Move = new CameraRelativeInput(); Move = new CameraRelativeInput();
Look = Vector2.zero; Look = Vector2.zero;
} }
@ -42,6 +44,7 @@ public class PlayerInputHandler : MonoBehaviour
Jump.Update(deltaTime); Jump.Update(deltaTime);
Blink.Update(deltaTime); Blink.Update(deltaTime);
Use.Update(deltaTime); Use.Update(deltaTime);
Freeze.Update(deltaTime);
} }
} }
@ -54,8 +57,9 @@ public class PlayerInputHandler : MonoBehaviour
_state = new PlayerInputState( _state = new PlayerInputState(
_inputSettings.JumpBufferTime, _inputSettings.JumpBufferTime,
_inputSettings.BlinkBufferTime, _inputSettings.BlinkBufferTime,
_inputSettings.UseBufferTime _inputSettings.UseBufferTime,
); _inputSettings.FreezeBufferTime
) ;
// run a first time update to ensure the dialogue system has an updated // run a first time update to ensure the dialogue system has an updated
// value for the player's input control scheme // value for the player's input control scheme
@ -64,7 +68,7 @@ public class PlayerInputHandler : MonoBehaviour
private void FixedUpdate() private void FixedUpdate()
{ {
_state.Update( Time.fixedDeltaTime ); _state.Update( Time.fixedDeltaTime);
float cameraRotation = _camera.transform.rotation.eulerAngles.y; float cameraRotation = _camera.transform.rotation.eulerAngles.y;
_state.Move.SetAngle(-cameraRotation); _state.Move.SetAngle(-cameraRotation);
@ -92,4 +96,10 @@ public class PlayerInputHandler : MonoBehaviour
if(context.started) if(context.started)
EventHandler.current.ArtefactPickUp(_nearbyArtefactID.Value); EventHandler.current.ArtefactPickUp(_nearbyArtefactID.Value);
} }
public void Freeze(InputAction.CallbackContext context)
{
_state.Freeze.Set( context.ReadValueAsButton() );
}
} }

View File

@ -8,7 +8,7 @@ public class PlayerInputSettings : ScriptableObject
public float JumpBufferTime => _jumpBufferTime; public float JumpBufferTime => _jumpBufferTime;
public float BlinkBufferTime => _blinkBufferTime; public float BlinkBufferTime => _blinkBufferTime;
public float UseBufferTime => _useBufferTime; public float UseBufferTime => _useBufferTime;
public float FreezeBufferTime => _freezeBufferTime;
public float MouseSensitivity => _mouseSens; public float MouseSensitivity => _mouseSens;
public float JoypadSensitivity => _joypadSens; public float JoypadSensitivity => _joypadSens;
@ -21,6 +21,9 @@ public class PlayerInputSettings : ScriptableObject
[SerializeField] [SerializeField]
private float _useBufferTime; private float _useBufferTime;
[SerializeField]
private float _freezeBufferTime;
[SerializeField] [SerializeField]
private float _mouseSens; private float _mouseSens;

View File

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

View File

@ -12,6 +12,9 @@ public class PlayerPowers : MonoBehaviour
[SerializeField] [SerializeField]
private bool _cheatBoost; private bool _cheatBoost;
[SerializeField]
private bool _cheatFreeze;
[Header( "References" )] [Header( "References" )]
[SerializeField] [SerializeField]
private PlayerPower _blink; private PlayerPower _blink;
@ -19,12 +22,17 @@ public class PlayerPowers : MonoBehaviour
[SerializeField] [SerializeField]
private PlayerPower _boost; private PlayerPower _boost;
[SerializeField]
private PlayerPower _freeze;
public PlayerPower Blink => _blink; public PlayerPower Blink => _blink;
public PlayerPower Boost => _boost; public PlayerPower Boost => _boost;
public PlayerPower Freeze => _freeze;
public void UpdatePowers( float dt, bool grounded ) public void UpdatePowers( float dt, bool grounded )
{ {
_blink.UpdatePower( dt, _cheatBlink, grounded ); _blink.UpdatePower( dt, _cheatBlink, grounded );
_boost.UpdatePower( dt, _cheatBoost, grounded ); _boost.UpdatePower( dt, _cheatBoost, grounded );
_freeze.UpdatePower(dt, _cheatFreeze, grounded);
} }
} }

View File

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

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76553ada4233edc458c3fed9b69e128f, type: 3}
m_Name: objectTimeScale
m_EditorClassIdentifier:
_initialValue: 1
_readOnly: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b68e167db44c0c42837e9a679da964e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,44 @@
using Ktyl.Util;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FreezeUI : MonoBehaviour
{
[SerializeField]
private Image cooldownImage;
[SerializeField]
private PlayerPower freeze;
[SerializeField]
private GameObject freezePanel;
[SerializeField]
private SerialFloat frozenTime;
private float cooldownTimer = 0f;
public void updateCooldownUI(float rawCooldownTimer, float regenerateTime, float timeSinceConsume)
{
if (rawCooldownTimer <= 0)
cooldownTimer = 0;
else
cooldownTimer = rawCooldownTimer / regenerateTime;
cooldownImage.fillAmount = cooldownTimer;
if (rawCooldownTimer > frozenTime)
freezePanel.SetActive(true);
else
freezePanel.SetActive(false);
}
private void Update()
{
updateCooldownUI(freeze.cooldown, freeze.regenerateTime, freeze.timeSinceConsume);
}
}

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

@ -44,6 +44,14 @@
"expectedControlType": "Button", "expectedControlType": "Button",
"processors": "", "processors": "",
"interactions": "" "interactions": ""
},
{
"name": "Freeze",
"type": "Button",
"id": "29f1599e-fe43-47df-ad25-8e712263d0ab",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
} }
], ],
"bindings": [ "bindings": [
@ -200,6 +208,28 @@
"action": "Blink", "action": "Blink",
"isComposite": false, "isComposite": false,
"isPartOfComposite": false "isPartOfComposite": false
},
{
"name": "",
"id": "8c9e09a3-477e-4760-bdba-f81beaec4988",
"path": "<Keyboard>/g",
"interactions": "",
"processors": "",
"groups": "PCMR",
"action": "Freeze",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6774e0ae-b8a1-4146-b779-01bbab6de14b",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"processors": "",
"groups": "Gamepad",
"action": "Freeze",
"isComposite": false,
"isPartOfComposite": false
} }
] ]
}, },

View File

@ -15,5 +15,6 @@ MonoBehaviour:
_jumpBufferTime: 0.1 _jumpBufferTime: 0.1
_blinkBufferTime: 0.1 _blinkBufferTime: 0.1
_useBufferTime: 0.1 _useBufferTime: 0.1
_freezeBufferTime: 2
_mouseSens: 0.15 _mouseSens: 0.15
_joypadSens: 1 _joypadSens: 1

View File

@ -0,0 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 24d28ac60e22b5547b2beb8679625039, type: 3}
m_Name: Freeze
m_EditorClassIdentifier:
_regenerateOnGround: 1
_regenerateInAir: 1
_regenerateTime: 7
_timeSinceConsume: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0cd9cf6494bb6f54d9b97631010d780e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76553ada4233edc458c3fed9b69e128f, type: 3}
m_Name: frozenTime
m_EditorClassIdentifier:
_initialValue: 3
_readOnly: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 19273ba4ac237ab4381926cfb195dda8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

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: