We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1bc90f5 commit 12188c5Copy full SHA for 12188c5
UOP1_Project/Assets/Scripts/Characters/NPC.cs
@@ -1,5 +1,4 @@
1
using System.Collections;
2
-using System.Collections.Generic;
3
using UnityEngine;
4
5
public enum NPCState { Idle = 0, Walk, Talk};
@@ -11,6 +10,13 @@ public class NPC : MonoBehaviour
11
10
12
public void SwitchToWalkState()
13
{
+ StartCoroutine(WaitBeforeSwitch());
14
+ }
15
+
16
+ IEnumerator WaitBeforeSwitch()
17
+ {
18
+ int wait_time = Random.Range(0, 4);
19
+ yield return new WaitForSeconds(wait_time);
20
npcState = NPCState.Walk;
21
}
22
0 commit comments