浏览代码

Now townsfolk possible to idle, walk, talk and choose behavior from MB

/main
Amel Negra 4 年前
当前提交
cef038ad
共有 12 个文件被更改,包括 118 次插入4 次删除
  1. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/StopTalking_TimeElapsed Condition SO.asset
  2. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/States/Talk.asset
  3. 17
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Townsfolk_TransitionTable.asset
  4. 2
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkTalkingSO.cs
  5. 1
      UOP1_Project/Assets/Scripts/Characters/Townsfolk.cs
  6. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Config/NPCPathwayConfigTownsfolk3.asset.meta
  7. 14
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkIdle.asset
  8. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkIdle.asset.meta
  9. 14
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkTalking.asset
  10. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkTalking.asset.meta
  11. 35
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkIdleSO.cs
  12. 11
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkIdleSO.cs.meta

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/StopTalking_TimeElapsed Condition SO.asset


m_Script: {fileID: 11500000, guid: 8139f9f328ed1144690b7a9ffca2d5b4, type: 3}
m_Name: StopTalking_TimeElapsed Condition SO
m_EditorClassIdentifier:
timerLength: 5
timerLength: 15

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/States/Talk.asset


_actions:
- {fileID: 11400000, guid: 03153937dd23e9c4098ad347cab2eaef, type: 2}
- {fileID: 11400000, guid: 098a951ce0fcb154bb9cb4900665dd9b, type: 2}
- {fileID: 11400000, guid: 0169c310b4cc2fe4091c9913e5aacf7e, type: 2}
- {fileID: 11400000, guid: 4ddcdf01c7784f84fa7b869c64b7d86e, type: 2}

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


m_EditorClassIdentifier:
_transitions:
- FromState: {fileID: 11400000, guid: 7aedcd9c179a4824eaf24451ab5689ba, type: 2}
ToState: {fileID: 11400000, guid: 1aad0cd7a387c6544a113d9fa8df1ce3, type: 2}
Conditions:
- ExpectedResult: 0
Condition: {fileID: 11400000, guid: 13401f769215f3245807de4b2ea14759, type: 2}
Operator: 0
- FromState: {fileID: 11400000, guid: 7aedcd9c179a4824eaf24451ab5689ba, type: 2}
- ExpectedResult: 1
Condition: {fileID: 11400000, guid: 13401f769215f3245807de4b2ea14759, type: 2}
Operator: 0
- ExpectedResult: 1
Condition: {fileID: 11400000, guid: 1748abd46aa04284b8bf442050ef790f, type: 2}
Operator: 0
- FromState: {fileID: 11400000, guid: 0e91b8fa2c44dc346b693ecfce70a7f1, type: 2}
ToState: {fileID: 11400000, guid: 7aedcd9c179a4824eaf24451ab5689ba, type: 2}
Conditions:

ToState: {fileID: 11400000, guid: 7aedcd9c179a4824eaf24451ab5689ba, type: 2}
Conditions:
- ExpectedResult: 0
Condition: {fileID: 11400000, guid: b9ba11af4ed48d645a1c41c3d3666135, type: 2}
Condition: {fileID: 11400000, guid: 5ef92fc56785ca244a1415862e4e8e6e, type: 2}
Operator: 0
- ExpectedResult: 1
Condition: {fileID: 11400000, guid: 13401f769215f3245807de4b2ea14759, type: 2}
Operator: 0

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


using UOP1.StateMachine.ScriptableObjects;
[CreateAssetMenu(menuName = "State Machines/Conditions/Is Townsfolk Talking")]
public class IsTalkingSO : StateConditionSO<IsTownsfolkTalkingCondition> { }
public class IsTownsfolkTalkingSO : StateConditionSO<IsTownsfolkTalkingCondition> { }
public class IsTownsfolkTalkingCondition : Condition
{

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


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

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


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

14
UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkIdle.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: b82f402e400d52c4a8a1e00453aaffa8, type: 3}
m_Name: IsTownsfolkIdle
m_EditorClassIdentifier:

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkIdle.asset.meta


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

14
UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkTalking.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: ebc65f4faf494ea4fa467b5df722f2b0, type: 3}
m_Name: IsTownsfolkTalking
m_EditorClassIdentifier:

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkTalking.asset.meta


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

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


using UnityEngine;
using UOP1.StateMachine;
using UOP1.StateMachine.ScriptableObjects;
[CreateAssetMenu(fileName = "IsTownsfolkIdle", menuName = "State Machines/Conditions/Is Townsfolk Idle")]
public class IsTownsfolkIdleSO : StateConditionSO<IsTownsfolkIdleCondition>
{
}
public class IsTownsfolkIdleCondition : Condition
{
//Component references
private Townsfolk _townsfolkScript;
public override void Awake(StateMachine stateMachine)
{
_townsfolkScript = stateMachine.GetComponent<Townsfolk>();
}
protected override bool Statement()
{
if (_townsfolkScript.isIdle)
{
// We don't want to consume it because we want the townsfolk to stay idle
//_townsfolkScript.isIdle = false;
return true;
}
else
{
return false;
}
}
}

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


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