Bär wartet nach aufwachen etc
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
@@ -24,7 +25,10 @@ public class PlayerMove : MonoBehaviour
|
||||
[SerializeField] private string inputNameVertical;
|
||||
|
||||
public Transform player;
|
||||
|
||||
|
||||
public Slider awarenessSlider;
|
||||
|
||||
private bool walking = true;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -104,7 +108,11 @@ public class PlayerMove : MonoBehaviour
|
||||
}
|
||||
}
|
||||
transform.Translate(moveDirection * speed * Time.deltaTime, Space.World);
|
||||
|
||||
|
||||
if (moveDirection != Vector3.zero && walking)
|
||||
{
|
||||
StartCoroutine(Step(0.3f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,8 +125,15 @@ public class PlayerMove : MonoBehaviour
|
||||
speed = basespeed;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
IEnumerator Step(float delay)
|
||||
{
|
||||
walking = false;
|
||||
yield return new WaitForSeconds(delay);
|
||||
awarenessSlider.value += 1f;
|
||||
walking = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user