浏览代码

WIP talking condition for townsfolks

/main
Amel Negra 4 年前
当前提交
6dda5831
共有 6 个文件被更改,包括 70 次插入8 次删除
  1. 6
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Townsfolk_TransitionTable.asset
  2. 4
      UOP1_Project/Assets/Scripts/Characters/Townsfolk.cs
  3. 15
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Config/TownsfolkEventChannel.asset
  4. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Config/TownsfolkEventChannel.asset.meta
  5. 34
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkTalkingSO.cs
  6. 11
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkTalkingSO.cs.meta

6
UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Townsfolk_TransitionTable.asset


- ExpectedResult: 0
Condition: {fileID: 11400000, guid: f5dfb7f0b89c7224a85f3e349c30893f, type: 2}
Operator: 0
- FromState: {fileID: 11400000, guid: 0e91b8fa2c44dc346b693ecfce70a7f1, type: 2}
ToState: {fileID: 11400000, guid: 1aad0cd7a387c6544a113d9fa8df1ce3, type: 2}
Conditions:
- ExpectedResult: 0
Condition: {fileID: 11400000, guid: 5ef92fc56785ca244a1415862e4e8e6e, type: 2}
Operator: 0
- FromState: {fileID: 11400000, guid: 1aad0cd7a387c6544a113d9fa8df1ce3, type: 2}
ToState: {fileID: 11400000, guid: 7aedcd9c179a4824eaf24451ab5689ba, type: 2}
Conditions:

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


public class Townsfolk : MonoBehaviour
{
public bool isTalking;
public bool isTalking; //This is checked by conditions in the StateMachine
void Start()
void Start()
{
}

15
UOP1_Project/Assets/ScriptableObjects/StateMachine/Config/TownsfolkEventChannel.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0c96b3d50eb64e741a7219a67ca93bdf, type: 3}
m_Name: TownsfolkEventChannel
m_EditorClassIdentifier:
description:

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Config/TownsfolkEventChannel.asset.meta


fileFormatVersion: 2
guid: ab763d3138762b2408988cb56b9697e9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

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


using UnityEngine;
using UOP1.StateMachine;
using UOP1.StateMachine.ScriptableObjects;
[CreateAssetMenu(menuName = "State Machines/Conditions/Is Townsfolk Talking")]
public class IsTalkingSO : StateConditionSO<IsTownsfolkTalkingCondition> { }
public class IsTownsfolkTalkingCondition : Condition
{
//Component references
private Townsfolk _townsfolkScript;
public override void Awake(StateMachine stateMachine)
{
_townsfolkScript = stateMachine.GetComponent<Townsfolk>();
}
protected override bool Statement()
{
if (_townsfolkScript.isTalking)
{
// Consume it
_townsfolkScript.isTalking = false;
return true;
}
else
{
return false;
}
}
}

11
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkTalkingSO.cs.meta


fileFormatVersion: 2
guid: ebc65f4faf494ea4fa467b5df722f2b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存