浏览代码

Make NPC wait for a random time before walking away in cutscene

/main
Amel Negra 3 年前
当前提交
599c6af5
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 8
      UOP1_Project/Assets/Scripts/Characters/NPC.cs

8
UOP1_Project/Assets/Scripts/Characters/NPC.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum NPCState { Idle = 0, Walk, Talk};

public void SwitchToWalkState()
{
StartCoroutine(WaitBeforeSwitch());
}
IEnumerator WaitBeforeSwitch()
{
int wait_time = Random.Range(0, 4);
yield return new WaitForSeconds(wait_time);
npcState = NPCState.Walk;
}
}
正在加载...
取消
保存