Compare commits
1 Commits
feat/depla
...
7f2c58f864
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f2c58f864 |
@@ -2,15 +2,45 @@ using UnityEngine;
|
||||
|
||||
public class SlowdownArea : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
|
||||
[Header("References")]
|
||||
public float maxSlow;
|
||||
public float slowSpeed;
|
||||
public float timer;
|
||||
|
||||
private float baseSpeed;
|
||||
private bool isInZone = false;
|
||||
private PlayerMovement player;
|
||||
|
||||
private void OnTriggerEnter(Collider area)
|
||||
{
|
||||
|
||||
if (area.CompareTag("Player")){
|
||||
player = area.GetComponent<PlayerMovement>();
|
||||
baseSpeed = player.WalkSpeed;
|
||||
isInZone = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider area)
|
||||
{
|
||||
if (area.CompareTag("Player"))
|
||||
{
|
||||
isInZone = false;
|
||||
timer = 0f;
|
||||
player.WalkSpeed = baseSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (!isInZone || player == null)
|
||||
return;
|
||||
timer += Time.deltaTime;
|
||||
float t = Mathf.Clamp(timer * slowSpeed, 0f, 1f);
|
||||
float multiplicator = Mathf.Lerp(1f, maxSlow, t);
|
||||
player.WalkSpeed = baseSpeed * multiplicator;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,15 +631,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -1060,9 +1060,6 @@ MonoBehaviour:
|
||||
ThrowForce: 20
|
||||
PickupDistance: 10
|
||||
isHoldingHead: 0
|
||||
HandTransform: {fileID: 0}
|
||||
ItemThrowForce: 10
|
||||
ItemPickupDistance: 5
|
||||
--- !u!114 &2936940972087595065
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d6592df1d7b185488bf479effca6aad
|
||||
guid: c90dca5ef1151259988c87df6c73a142
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@@ -9,6 +9,5 @@ EditorBuildSettings:
|
||||
path: Assets/Level/Scenes/Level/01/Level01.unity
|
||||
guid: 002c7c1365eb84470a077e39ac50a31c
|
||||
m_configObjects:
|
||||
com.unity.input.settings: {fileID: 11400000, guid: 23cbff887a25b3802a937fef9deab3ec, type: 2}
|
||||
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
|
||||
m_UseUCBPForAssetBundles: 0
|
||||
|
||||
Reference in New Issue
Block a user