Ejemplo n.º 1
0
        private static void _SetRotationKey(Transform joint)
        {
            var oldQ = joint.localRotation;

            joint.Rotate(new Vector3(1, 0, 0));
            Undo.RecordObject(joint, "baking");
            joint.localRotation = oldQ;
            HotFix.FixRotation(joint);
        }
Ejemplo n.º 2
0
 public IEnumerator CheckBinaryCommand()
 {
     while (SocketClient.ByteCommands.Count > 0)
     {
         var re = SocketClient.ByteCommands.Dequeue();
         HotFix.InvokeScriptMethod(re);
         yield return(new WaitForEndOfFrame());
     }
 }
Ejemplo n.º 3
0
 public System.Int32 Invoke_HotFix_Int32_Int32_Int32(HotFix arg0, System.Int32 arg1, System.Int32 arg2)
 {
     LuaAPI.PushLuaFunction(L, reference);
     LuaCallback.PushObject(L, arg0);
     LuaCallback.PushNumber(L, arg1);
     LuaCallback.PushNumber(L, arg2);
     LuaAPI.CallLuaFunction(L, 3, 1);
     System.Int32 arg3 = (System.Int32)LuaCallback.ToNumber(L, -1);
     return(arg3);
 }
Ejemplo n.º 4
0
    public static int Add(System.IntPtr L)
    {
        int nargs = LuaAPI.GetTop(L);

        if (nargs == 3 && LuaAPI.IsObject(L, 1) && LuaAPI.IsNumber(L, 2) && LuaAPI.IsNumber(L, 3))
        {
            HotFix       arg0 = (HotFix)LuaCallback.ToObject(L, 1);
            System.Int32 arg1 = (System.Int32)LuaCallback.ToNumber(L, 2);
            System.Int32 arg2 = (System.Int32)LuaCallback.ToNumber(L, 3);
            System.Int32 res  = arg0.Add(arg1, arg2);
            LuaCallback.PushNumber(L, res);
            return(1);
        }
        return(0);
    }
Ejemplo n.º 5
0
        /// <summary>
        /// mirror thisBone's data to corresponding
        /// </summary>
        public void ApplyMirror(Transform thisBone)
        {
            Transform thatBone = GetMirrorBone(thisBone);

            if (thatBone == null)
            {
                return;
            }

            Undo.RecordObject(thatBone, "Apply Mirror");

            Axis selfAxisValue       = _GetAxisValue(thisBone);
            Axis selfParentAxisValue = _GetAxisValueForParent(thisBone);

            //rot
            {
                Vector3    planeNormal = Vector3.right;
                Quaternion oldQ        = thisBone.localRotation;
                Quaternion newQ        = oldQ;
                if (selfAxisValue != selfParentAxisValue)
                {
                    planeNormal = _GetPlaneNormal(selfParentAxisValue);
                    newQ        = _ReflectQ(oldQ, selfAxisValue, planeNormal);
                }
                else
                {
                    switch (selfAxisValue)
                    {
                    case Axis.XY:
                    {
                        newQ.x = -newQ.x;
                        newQ.y = -newQ.y;
                    }
                    break;

                    case Axis.XZ:
                    {
                        newQ.x = -newQ.x;
                        newQ.z = -newQ.z;
                    }
                    break;

                    case Axis.YZ:
                    {
                        newQ.y = -newQ.y;
                        newQ.z = -newQ.z;
                    }
                    break;

                    default:
                        Dbg.LogErr("MirrorCtrl.ApplyMirror: unexpected parentAxisValue: {0}", selfAxisValue);
                        break;
                    }
                }
                thatBone.localRotation = newQ;
            }

            //pos
            {
                Vector3 oldP = thisBone.localPosition;
                Vector3 newP = oldP;
                switch (selfParentAxisValue)
                {
                case Axis.XZ:
                {
                    newP.y = -newP.y;
                }
                break;

                case Axis.XY:
                {
                    newP.z = -newP.z;
                }
                break;

                case Axis.YZ:
                {
                    newP.x = -newP.x;
                }
                break;

                default:
                    Dbg.LogErr("MirrorCtrl.ApplyMirror: unexpected mirror axis value (2nd): {0}", selfParentAxisValue);
                    break;
                }
                thatBone.localPosition = newP;
            }

            //scale
            {
                thatBone.localScale = thisBone.localScale;
            }

            HotFix.FixRotation(thatBone);
        }
Ejemplo n.º 6
0
 private void OnDestroy()
 {
     HotFix.StopHotFix();
 }