Esempio n. 1
0
        public void Setup()
        {
            var go = new GameObject("TestObject");

            m_SkinnedSprite = Resources.Load <Sprite>("bird");
            m_SpriteSkin    = go.AddComponent <SpriteSkin>();
            m_SpriteSkin.spriteRenderer.sprite = m_SkinnedSprite;
            m_SpriteSkin.CreateBoneHierarchy();

            m_SkeletonView = Substitute.For <ISkeletonView>();
            m_SkeletonView.hotBoneID.Returns(x => m_HotBoneID);
            m_SkeletonView.hoveredBoneID.Returns(x => m_HoveredBoneID);
            m_SkeletonView.hoveredBodyID.Returns(x => m_HoveredBodyID);
            m_SkeletonView.hoveredJointID.Returns(x => m_HoveredJointID);
            m_SkeletonView.hoveredTailID.Returns(x => m_HoveredTailID);
            m_SkeletonView.IsActionHot(Arg.Any <SkeletonAction>()).Returns(x => m_HotAction == (SkeletonAction)x[0]);
            m_SkeletonView.CanLayout().Returns(x => true);

            m_Undo            = Substitute.For <IUndo>();
            m_BoneGizmoToggle = Substitute.For <IBoneGizmoToggle>();
            m_BoneGizmoToggle.enableGizmos.Returns(x => true);

            m_BoneGizmoController = new BoneGizmoController(m_SkeletonView, m_Undo, m_BoneGizmoToggle);

            m_HotBoneID      = 0;
            m_HoveredBodyID  = 0;
            m_HoveredBoneID  = 0;
            m_HoveredJointID = 0;
            m_HoveredTailID  = 0;
            m_HotAction      = SkeletonAction.None;
        }
Esempio n. 2
0
        private void PrepareBones()
        {
            if (!view.CanLayout())
            {
                return;
            }

            if (view.IsActionHot(SkeletonAction.None))
            {
                m_CachedBones.Clear();
            }

            m_BoneData.Clear();

            foreach (var skinComponent in m_SkinComponents)
            {
                if (skinComponent == null)
                {
                    continue;
                }

                PrepareBones(skinComponent);
            }
        }