浏览代码

Added isPickingUp SO condition to state machine

/main
Amel 4 年前
当前提交
cc52237b
共有 2 个文件被更改,包括 43 次插入0 次删除
  1. 32
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsPickingUpSO.cs
  2. 11
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsPickingUpSO.cs.meta

32
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsPickingUpSO.cs


using UnityEngine;
using UOP1.StateMachine;
using UOP1.StateMachine.ScriptableObjects;
[CreateAssetMenu(menuName = "State Machines/Conditions/Is Picking Up")]
public class IsPickingUpSO : StateConditionSO<IsPickingUpCondition> { }
public class IsPickingUpCondition : Condition
{
//Component references
private InteractionManager _interactScript;
public override void Awake(StateMachine stateMachine)
{
_interactScript = stateMachine.GetComponentInChildren<InteractionManager>();
}
protected override bool Statement()
{
if (_interactScript.currentInteraction == Interaction.PickUp)
{
// Consume the input
_interactScript.currentInteraction = Interaction.None;
return true;
}
else
{
return false;
}
}
}

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


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