浏览代码

Made Initial state an enum

/main
Amel Negra 3 年前
当前提交
bd7b83fa
共有 3 个文件被更改,包括 7 次插入7 次删除
  1. 2
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkIdleSO.cs
  2. 5
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkTalkingSO.cs
  3. 7
      UOP1_Project/Assets/Scripts/Characters/Townsfolk.cs

2
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkIdleSO.cs


protected override bool Statement()
{
if (_townsfolkScript.isIdle)
if (_townsfolkScript.townsfolkInitialState == InitialState.Idle)
{
// We don't want to consume it because we want the townsfolk to stay idle
return true;

5
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkTalkingSO.cs


protected override bool Statement()
{
if (_townsfolkScript.isTalking)
if (_townsfolkScript.townsfolkInitialState == InitialState.Talk)
// Consume it
_townsfolkScript.isTalking = false;
return true;
}
else

7
UOP1_Project/Assets/Scripts/Characters/Townsfolk.cs


using System.Collections.Generic;
using UnityEngine;
public enum InitialState { Idle = 0, Walk, Talk };
public bool isTalking; //This is checked by conditions in the StateMachine
public bool isIdle; //This is checked by conditions in the StateMachine
public InitialState townsfolkInitialState; //This is checked by conditions in the StateMachine
void Start()
{

正在加载...
取消
保存