浏览代码

Initial commit with fix (#149)

/main
GitHub 4 年前
当前提交
0308bf97
共有 2 个文件被更改,包括 14 次插入6 次删除
  1. 14
      UOP1_Project/Assets/Scripts/StateMachine/Core/StateTransition.cs
  2. 6
      UOP1_Project/Assets/Scripts/StateMachine/ScriptableObjects/StateTransitionSO.cs

14
UOP1_Project/Assets/Scripts/StateMachine/Core/StateTransition.cs


{
public class StateTransition : IStateComponent
{
private readonly State _targetState;
private readonly StateCondition[] _conditions;
private readonly int[] _resultGroups;
private readonly bool[] _results;
private State _targetState;
private StateCondition[] _conditions;
private int[] _resultGroups;
private bool[] _results;
internal StateTransition() { }
{
Init(targetState, conditions, resultGroups);
}
internal void Init(State targetState, StateCondition[] conditions, int[] resultGroups = null)
{
_targetState = targetState;
_conditions = conditions;

6
UOP1_Project/Assets/Scripts/StateMachine/ScriptableObjects/StateTransitionSO.cs


if (createdInstances.TryGetValue(this, out var obj))
return (StateTransition)obj;
var transition = new StateTransition();
createdInstances.Add(this, transition);
var transition = new StateTransition(state, conditions, resultGroups);
createdInstances.Add(this, transition);
transition.Init(state, conditions, resultGroups);
return transition;
}

正在加载...
取消
保存