Exemplo n.º 1
0
 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);
    }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
    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;
    }
Exemplo n.º 5
0
    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;
    }
Exemplo n.º 6
0
        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();
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
    // 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
 }
Exemplo n.º 9
0
 public override void Execute(ActionHook o)
 {
     value = Input.GetAxis(targetInput);
 }
Exemplo n.º 10
0
 public abstract void Execute(ActionHook o);