浏览代码

Added IsInDialogue to step controller

/main
Amel Negra 4 年前
当前提交
a186115b
共有 6 个文件被更改,包括 99 次插入5 次删除
  1. 18
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Townsfolk_TransitionTable.asset
  2. 22
      UOP1_Project/Assets/Scripts/Quests/StepController.cs
  3. 14
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkInDialogue.asset
  4. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Townsfolk/Conditions/IsTownsfolkInDialogue.asset.meta
  5. 31
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkInDialogueSO.cs
  6. 11
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkInDialogueSO.cs.meta

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


Operator: 0
- ExpectedResult: 1
Condition: {fileID: 11400000, guid: 13401f769215f3245807de4b2ea14759, type: 2}
Operator: 1
- ExpectedResult: 0
Condition: {fileID: 11400000, guid: 1748abd46aa04284b8bf442050ef790f, 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: f4c89ffbe6ca8fe46ae22ec9d191671a, type: 2}
Operator: 0
- FromState: {fileID: 11400000, guid: 1aad0cd7a387c6544a113d9fa8df1ce3, type: 2}
ToState: {fileID: 11400000, guid: 0e91b8fa2c44dc346b693ecfce70a7f1, type: 2}
Conditions:
- ExpectedResult: 1
Condition: {fileID: 11400000, guid: f4c89ffbe6ca8fe46ae22ec9d191671a, type: 2}
Operator: 0
- ExpectedResult: 0
Condition: {fileID: 11400000, guid: 3bc21858d79b57d4ea392b00be1d0f85, type: 2}
Operator: 0

22
UOP1_Project/Assets/Scripts/Quests/StepController.cs


[Header("Broadcasting on channels")]
[SerializeField] private DialogueDataChannelSO _startDialogueEvent = default;
[Header("Listening to")]
[SerializeField] private VoidEventChannelSO _endDialogueEvent = default;
public bool IsInDialogue = false;
_loseDialogueEvent.OnEventRaised += PlayLoseDialogue;
_loseDialogueEvent.OnEventRaised += PlayLoseDialogue;
}

void StartDialogue()
{
_startDialogueEvent.RaiseEvent(_currentDialogue);
_startDialogueEvent.RaiseEvent(_currentDialogue);
IsInDialogue = true;
_endDialogueEvent.OnEventRaised += EndDialogue;
void EndDialogue()
{
IsInDialogue = false;
_endDialogueEvent.OnEventRaised -= EndDialogue;
}
void PlayLoseDialogue()
{
if (_questData != null)

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

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


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

31
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTownsfolkInDialogueSO.cs


using UnityEngine;
using UOP1.StateMachine;
using UOP1.StateMachine.ScriptableObjects;
[CreateAssetMenu(menuName = "State Machines/Conditions/Is Townsfolk In Dialogue")]
public class IsTownsfolkInDialogueSO : StateConditionSO<IsTownsfolkDialogueCondition> { }
public class IsTownsfolkDialogueCondition : Condition
{
//Component references
private StepController _stepControllerScript;
public override void Awake(StateMachine stateMachine)
{
_stepControllerScript = stateMachine.GetComponent<StepController>();
}
protected override bool Statement()
{
if (_stepControllerScript.IsInDialogue)
{
return true;
}
else
{
return false;
}
}
}

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


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