public static MTActionState RunAction(this GameObject target, MTAction action) { Debug.Assert(action != null, "Argument must be non-nil"); return(MTActionManager.Instance.AddAction(action, target, !target.IsRunning())); }
public static void AddAction(this GameObject target, MTAction action, bool paused = false) { if (MTActionManager.Instance != null) { MTActionManager.Instance.AddAction(action, target, paused); } }
public MTActionState AddAction(MTAction action, GameObject target, bool paused = false) { Debug.Assert(action != null); Debug.Assert(target != null); HashElement element; if (!targets.TryGetValue(target, out element)) { element = new HashElement(); element.Paused = paused; element.Target = target; targets.Add(target, element); targetsAvailable = true; } ActionAllocWithHashElement(element); var isActionRunning = false; for (int i = 0; i < element.ActionStates.Count; i++) { var existingState = element.ActionStates [i]; if (existingState.Action == action) { isActionRunning = true; break; } } Debug.Assert(!isActionRunning, "MTUnityAction : Action is already running for this target."); var state = action.StartAction(target); element.ActionStates.Add(state); return state; }
public static MTActionState RunAction(this MonoBehaviour target, MTAction action) { Debug.Assert(action != null, "Argument must be non-nil"); GameObject curObj = target.gameObject; return(curObj.RunAction(action)); }
public MTActionState(MTAction action, GameObject target) { this.Action = action; this.Target = target; this.OriginalTarget = target; // if (target != null) // this.Layer = target.Layer; // Debug.Assert(false,"not implement"); }
internal void RemoveAction(MTAction action, GameObject target) { if (action == null || target == null) { return; } HashElement element; if (targets.TryGetValue(target, out element)) { int limit = element.ActionStates.Count; bool actionFound = false; for (int i = 0; i < limit; i++) { var actionState = element.ActionStates[i]; if (actionState.Action == action && actionState.OriginalTarget == target) { RemoveActionAtIndex(i, element); actionFound = true; break; } } if (!actionFound) { // Debug.LogWarning ("MTUnityAction : RemoveAction: Action not found");//Comment Mark,Don't Delete } } else { // Debug.LogWarning ("MTUnityAction : RemoveAction: Target not found");//Comment Mark,Don't Delete } }
public MTActionState AddAction(MTAction action, GameObject target, bool paused = false) { Debug.Assert(action != null); Debug.Assert(target != null); HashElement element; if (!targets.TryGetValue(target, out element)) { element = new HashElement(); element.Paused = paused; element.Target = target; targets.Add(target, element); targetsAvailable = true; } ActionAllocWithHashElement(element); var isActionRunning = false; for (int i = 0; i < element.ActionStates.Count; i++) { var existingState = element.ActionStates [i]; if (existingState.Action == action) { isActionRunning = true; break; } } Debug.Assert(!isActionRunning, "MTUnityAction : Action is already running for this target."); var state = action.StartAction(target); element.ActionStates.Add(state); return(state); }
public static MTActionState RunAction(this GameObject target, MTAction action) { Debug.Assert(action != null, "Argument must be non-nil"); return MTActionManager.instance.AddAction(action, target, !target.IsRunning()); }
public static MTActionState RunAction(this MonoBehaviour target, MTAction action) { Debug.Assert(action != null, "Argument must be non-nil"); GameObject curObj = target.gameObject; return curObj.RunAction (action); }
public static void AddAction(this GameObject target,MTAction action, bool paused = false) { if (MTActionManager.instance != null) MTActionManager.instance.AddAction(action, target, paused); }
internal void RemoveAction(MTAction action, GameObject target) { if (action == null || target == null) return; HashElement element; if (targets.TryGetValue(target, out element)) { int limit = element.ActionStates.Count; bool actionFound = false; for (int i = 0; i < limit; i++) { var actionState = element.ActionStates[i]; if (actionState.Action == action && actionState.OriginalTarget == target) { RemoveActionAtIndex(i, element); actionFound = true; break; } } if (!actionFound) Debug.Log("MTUnityAction : RemoveAction: Action not found"); } else { Debug.Log("MTUnityAction : RemoveAction: Target not found"); } }