Compare commits
2 Commits
7f2c58f864
...
feat/depla
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22da6f75e1 | ||
|
|
79dad388a1 |
@@ -2,45 +2,15 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class SlowdownArea : MonoBehaviour
|
public class SlowdownArea : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
[Header("References")]
|
void Start()
|
||||||
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
|
// Update is called once per frame
|
||||||
void Update()
|
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}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
||||||
propertyPath: m_LocalScale.x
|
propertyPath: m_LocalScale.x
|
||||||
value: 4
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
||||||
propertyPath: m_LocalScale.y
|
propertyPath: m_LocalScale.y
|
||||||
value: 4
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
||||||
propertyPath: m_LocalScale.z
|
propertyPath: m_LocalScale.z
|
||||||
value: 4
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
@@ -1060,6 +1060,9 @@ MonoBehaviour:
|
|||||||
ThrowForce: 20
|
ThrowForce: 20
|
||||||
PickupDistance: 10
|
PickupDistance: 10
|
||||||
isHoldingHead: 0
|
isHoldingHead: 0
|
||||||
|
HandTransform: {fileID: 0}
|
||||||
|
ItemThrowForce: 10
|
||||||
|
ItemPickupDistance: 5
|
||||||
--- !u!114 &2936940972087595065
|
--- !u!114 &2936940972087595065
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: c90dca5ef1151259988c87df6c73a142
|
guid: 0d6592df1d7b185488bf479effca6aad
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ EditorBuildSettings:
|
|||||||
path: Assets/Level/Scenes/Level/01/Level01.unity
|
path: Assets/Level/Scenes/Level/01/Level01.unity
|
||||||
guid: 002c7c1365eb84470a077e39ac50a31c
|
guid: 002c7c1365eb84470a077e39ac50a31c
|
||||||
m_configObjects:
|
m_configObjects:
|
||||||
|
com.unity.input.settings: {fileID: 11400000, guid: 23cbff887a25b3802a937fef9deab3ec, type: 2}
|
||||||
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
|
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
|
||||||
m_UseUCBPForAssetBundles: 0
|
m_UseUCBPForAssetBundles: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user