void RegisterCustomMethod(CustomPlayMethod method, bool showWarning) { if (method == null) { return; } string methodName = method.Method.Name; if (customPlayMethods.ContainsKey(methodName)) { if (showWarning) { Debug.LogWarning("<i>'" + methodName + "'</i>" + " Can't be registered, a Custom Play Method with the same name is already registered."); } } else { customPlayMethods.Add(methodName, method); } for (int i = 0; i < states.Count; i++) { MLPASAnimatorSFX.StateSFX state = states[i]; if (state.useCustomPlayMethod && state.methodName == methodName) { states[i].customPlayMethod = method; } } }
/// <summary> /// Unregister a Custom Play Method in this <see cref="MLPASAnimatorSFXController"/>. /// </summary> /// <param name="method"></param> public void UnregisterCustomMethod(CustomPlayMethod method) { if (method == null) { return; } string methodName = method.Method.Name; if (customPlayMethods.ContainsKey(methodName)) { customPlayMethods.Remove(methodName); for (int i = 0; i < states.Count; i++) { MLPASAnimatorSFX.StateSFX state = states[i]; if (state.useCustomPlayMethod && state.methodName == methodName) { states[i].customPlayMethod = null; } } } else { Debug.LogWarning("Custom Play Method: " + "<i>'" + methodName + "'</i>" + " is already unregisted."); } if (registeredPlayMethods.Contains(method)) { registeredPlayMethods.Remove(method); } }