feat (root crawler): start the vine grip around the player body when it enter in the slowdown area
This commit is contained in:
@@ -2,15 +2,20 @@ using UnityEngine;
|
||||
|
||||
public class RootCrawler : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Transform target;
|
||||
public float maxHeight;
|
||||
public float crawlingSpeed;
|
||||
|
||||
private float height = 0f;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
height += Time.deltaTime * crawlingSpeed;
|
||||
height = Mathf.Clamp(height, 0f, maxHeight);
|
||||
transform.position = target.position + Vector3.up * height;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user