public static JActionState RunAction(this GameObject target, JAction action) { Debug.Assert(action != null, "Argument must be non-nil"); return(JActionManager.Instance.AddAction(action, target, !target.IsRunning())); }
public static void AddAction(this GameObject target, JAction action, bool paused = false) { if (JActionManager.Instance != null) { JActionManager.Instance.AddAction(action, target, paused); } }
public static JActionState RunAction(this MonoBehaviour target, JAction action) { Debug.Assert(action != null, "Argument must be non-nil"); GameObject curObj = target.gameObject; return(curObj.RunAction(action)); }
public JActionState(JAction 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(JAction 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 ("JUnityAction : RemoveAction: Action not found");//Comment Mark,Don't Delete } } else { // Debug.LogWarning ("JUnityAction : RemoveAction: Target not found");//Comment Mark,Don't Delete } }
public JActionState AddAction(JAction 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, "JUnityAction : Action is already running for this target."); var state = action.StartAction(target); element.ActionStates.Add(state); return(state); }