コード例 #1
0
        private void HandleRotateBone()
        {
            var pivot = hoveredBone;

            if (view.IsActionHot(SkeletonAction.RotateBone))
            {
                pivot = hotBone;
            }

            if (pivot == null)
            {
                return;
            }

            FindPivotTransform(pivot, out pivot);

            if (pivot == null)
            {
                return;
            }

            float deltaAngle;

            if (view.DoRotateBone(pivot.position, pivot.forward, out deltaAngle))
            {
                SetBoneRotation(deltaAngle);
            }
        }
コード例 #2
0
        public void RotateBone_SingleSelection()
        {
            m_HotAction = SkeletonAction.RotateBone;
            m_HotBoneID = m_SpriteSkin.boneTransforms[0].GetInstanceID();

            float deltaAngle;

            m_SkeletonView.DoRotateBone(Arg.Any <Vector3>(), Arg.Any <Vector3>(), out deltaAngle).Returns(x =>
            {
                x[2] = 90f;
                return(true);
            });

            Selection.activeGameObject = m_SpriteSkin.boneTransforms[0].gameObject;
            m_BoneGizmoController.OnSelectionChanged();
            m_BoneGizmoController.OnGUI();

            Assert.That(m_SpriteSkin.boneTransforms[0].rotation, Is.EqualTo(new Quaternion(0f, 0f, 0.5560408f, 0.8311549f)).Using(quatCompare));
        }