public void Tick(ActionHook o) { for (int i = 0; i < actions.Count; i++) { actions[i].Execute(o); } }
public void sendHook(HookType type, string message) { Hook temp; switch (type) { case HookType.Action: temp = new ActionHook(message); break; case HookType.Error: temp = new ErrorHook(message); break; case HookType.Input: temp = new InputHook(message); break; default: temp = new Hook(); Debug.LogError("sendHook with string parameter could not determine hook type!"); break; } passHook(temp); }
public HookCtroller(params ActionHook[] actionHooks) { if (actionHooks != null)//删除无用的hooks { actionHooks = (from hook in actionHooks where hook != null select hook).ToArray(); } if (actionHooks != null && actionHooks.Length > 0) { active = true; statu = ExecuteStatu.UnStarted; hooks = new ActionHook[actionHooks.Length]; for (int i = 0; i < actionHooks.Length; i++) { hooks[i] = ScriptableObject.Instantiate(actionHooks[i]); hooks[i].name = actionHooks[i].name; } } else { statu = ExecuteStatu.Completed; active = false; } }
public override void Execute(ActionHook o) { if (cameraTransform.value == null) { return; } Transform t = o.mTransform; float h = horizontal.value; float v = vertical.value; Vector3 RotateDir = cameraTransform.value.forward * v; RotateDir += cameraTransform.value.right * h; if (RotateDir == Vector3.zero) { RotateDir = t.forward; } Quaternion targetRot = Quaternion.LookRotation(RotateDir); Quaternion rotation = Quaternion.Slerp(t.rotation, targetRot, Time.deltaTime * 8); t.rotation = rotation; }
public override void Execute(ActionHook o) { Transform t = o.mTransform; float h = horizontal.value; float v = vertical.value; float moveAmount = Mathf.Clamp01(Mathf.Abs(h) + Mathf.Abs(v)); Vector3 moveDir = t.forward * moveAmount; t.position += moveDir * 0.4f; }
private void OnCommandObjComplete(ActionHook obj) { if (statu != ExecuteStatu.Completed) { var notComplete = Array.FindAll <ActionHook>(hooks, x => (x as ActionHook).QueueID == obj.QueueID && x.Statu != ExecuteStatu.Completed); if (notComplete.Length == 0) { if (!ExecuteAStep(isForceAuto)) { CoreEndExecute(); if (onEndExecute != null) { onEndExecute.Invoke(); } } } } }
// Override the ones of these stubs that you actually use. protected virtual void actionHook(ActionHook hook) { return; }
public override void Execute(ActionHook o) { targetTransform.value = o.mTransform; o.currentState = null; // instead of nullifing, jump to another state }
public override void Execute(ActionHook o) { value = Input.GetAxis(targetInput); }
public abstract void Execute(ActionHook o);