public GotoStateAction(string targetState, bool requireAll, bool everyFrame, params Condition <T, TT>[] conditions) : base(everyFrame, false) { _targetState = targetState; _conditions = conditions; _requireAll = requireAll; _weightedStateNames = null; _weightedStates = null; }
public override void OnCreate() { base.OnCreate(); StateMachine _machine = _hostState.GetStateMachine(); if (_weightedStateNames != null) { WeightedObject <Tuple <State, int> >[] _states = new WeightedObject <Tuple <State, int> > [_weightedStateNames.Length]; for (int i = 0; i < _states.Length; i++) { _states[i] = new WeightedObject <Tuple <State, int> >(_machine.GetState(_weightedStateNames[i].item), _weightedStateNames[i].weight); } _weightedStates = new WeightedCollection <Tuple <State, int> >(true, _states); return; } _state = _machine.GetState(_targetState); }