private void SetCommand(FsmInput type, float value = 0f) { var command = CommandsContainer.GetAvailableItem(); command.Type = type; command.AdditioanlValue = value; }
protected void SetNewCommandFromFunctionCall(FsmInput type, float additionalValue = 0) { Logger.DebugFormat("Request Do Action : {0} AdditionalValue : {1}", type, additionalValue); var availableCommand = commandsContainer.GetAvailableItem(); availableCommand.Type = type; availableCommand.AdditionalValue = additionalValue; }
protected void SetNewCallbackFromFunctionCall(FsmInput trigger, FsmInput removeCondition, System.Action callBack) { if (callBack != null) { _callBackRegister.AddNewCallBack(trigger, removeCondition, callBack); Logger.DebugFormat("New callback from function call: {0}", trigger); } }
private void SetCommand(IAdaptiveContainer <IFsmInputCommand> commands, FsmInput type, float additionalValue = float.NaN, float alterAdditionalValue = float.NaN) { var item = commands.GetAvailableItem(command => (command.Type == FsmInput.None || command.Type == type)); SetCommandParam(item, type, additionalValue, alterAdditionalValue); }
public static bool SimpleCommandHandler(IFsmInputCommand command, FsmInput type) { var ret = command.IsMatch(type); if (ret) { command.Handled = true; } return(ret); }
public void ResetItem(FsmInput type) { for (var i = 0; i < this.Length; ++i) { if (this[i].Type == type) { this[i].Reset(); } } }
public void TryRemoveCallBack(FsmInput type) { System.Action remove; _callBackRemove.TryGetValue(type, out remove); if (remove != null) { remove.Invoke(); } }
public void TryInvokeCallBack(FsmInput type) { System.Action callBack; _inputCallBack.TryGetValue(type, out callBack); if (callBack != null) { callBack.Invoke(); Logger.DebugFormat("Animation End Callback: {0}", type); } }
public void AddNewCallBack(FsmInput trigger, FsmInput removeCondition, System.Action callBack) { if (!_inputCallBack.ContainsKey(trigger)) { if (!_callBackRemove.ContainsKey(removeCondition)) { _callBackRemove[removeCondition] = default(System.Action); } _callBackRemove[removeCondition] += () => _inputCallBack[trigger] = null; } _inputCallBack[trigger] = callBack; }
private void SetCommandParam(IFsmInputCommand command, FsmInput type, float additionalValue = float.NaN, float alterAdditionalValue = float.NaN) { command.Type = type; if (!float.IsNaN(additionalValue)) { command.AdditioanlValue = additionalValue; } if (!float.IsNaN(alterAdditionalValue)) { command.AlternativeAdditionalValue = alterAdditionalValue; } }
public bool TryInvokeCallBack(FsmInput type) { bool ret = false; System.Action callBack; _inputCallBack.TryGetValue(type, out callBack); if (callBack != null) { callBack.Invoke(); ret = true; Logger.InfoFormat("Animation End Callback: {0}", type); } return(ret); }
private bool IsBeLimited(FsmInput input, List <FsmInput> limits) { if (null == limits) { return(false); } foreach (var limit in limits) { if (input != limit) { continue; } Logger.ErrorFormat("FsmInput have be limited: {0}", input); return(true); } return(false); }
private void ClearActionByCmdHelper(IAdaptiveContainer <IFsmInputCommand> commands, FsmInput clearAction) { for (int i = 0; i < commands.Length; ++i) { if (commands[i].Type == clearAction) { commands[i].Type = FsmInput.None; commands[i].Handled = false; return; } } }
private void ClearActionByCmd(IAdaptiveContainer <IFsmInputCommand> commands, FsmInput cmd, FsmInput clearAction) { for (int i = 0; i < commands.Length; ++i) { if (commands[i].Type == cmd) { ClearActionByCmdHelper(commands, clearAction); return; } } }
// 添加需要打断的 input public void AddInterruptInput(FsmInput input) { _interruptInputs.Add(input); }
public DiveTransition(short id, short target, int duration, float fromValue, float toValue, FsmInput enterInput) : base(id, target, duration) { _fromValue = fromValue; _toValue = toValue; _simpleTransferCondition = (command, addOutput) => FsmTransition.SimpleCommandHandler(command, enterInput); }
public bool IsMatch(FsmInput type) { return(!_handled && _type == type); }
private void CheckConditionAndSetCommand(IUserCmd cmd, XmlConfig.EPlayerInput mappedInput, FsmInput fsmInput) { if (null != cmd.FilteredInput && cmd.FilteredInput.IsInput(mappedInput)) { SetCommand(fsmInput); } else { if (null == cmd.FilteredInput) { Logger.Error("FilteredInput in cmd should never be null !"); } } }