feat (root crawler): start the vine grip around the player body when it enter in the slowdown area
This commit is contained in:
@@ -7,12 +7,15 @@ public class SlowdownArea : MonoBehaviour
|
||||
public float maxSlow;
|
||||
public float slowSpeed;
|
||||
public float timer;
|
||||
|
||||
|
||||
[Header("Root Crawler")]
|
||||
public GameObject rootCrawlerPrefab;
|
||||
|
||||
private float baseJump;
|
||||
private bool isInZone = false;
|
||||
private PlayerMovement player;
|
||||
private PlayerJump jump;
|
||||
private GameObject currentCrawler;
|
||||
|
||||
private void OnTriggerEnter(Collider area)
|
||||
{
|
||||
@@ -22,18 +25,25 @@ public class SlowdownArea : MonoBehaviour
|
||||
baseJump = 5.0f;
|
||||
jump.JumpForce = 1.5f;
|
||||
isInZone = true;
|
||||
if (currentCrawler == null) {
|
||||
currentCrawler = Instantiate(rootCrawlerPrefab, player.transform.position, Quaternion.identity);
|
||||
RootCrawler crawler = currentCrawler.GetComponent<RootCrawler>();
|
||||
crawler.target = player.transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider area)
|
||||
{
|
||||
if (area.CompareTag("Player"))
|
||||
{
|
||||
if (area.CompareTag("Player")) {
|
||||
isInZone = false;
|
||||
timer = 0f;
|
||||
player.ApplySlow(1f);
|
||||
player.ApplyAnimationSlow(1f);
|
||||
jump.JumpForce = baseJump;
|
||||
if (currentCrawler != null) {
|
||||
Destroy(currentCrawler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user