public IStateAction <TState> GetStateActionForData(IActionData data) { var dataType = data.GetType(); if (!_actions.ContainsKey(dataType)) { Debug.LogError($"There's no registered action for data of type {dataType}"); return(null); } return(_actions[dataType]); }
public static void Apply(this IActionData data, ISystemWindow window, ref Rectangle region) { var type = data.GetType(); if (_methods.TryGetValue(type, out var method)) { var parameters = new object[] { data, window, region }; method.Invoke(null, parameters); region = (Rectangle)parameters[2]; } else { throw new ArgumentException($"Not found suitable method for '{type}' type"); } }