Ejemplo n.º 1
0
        private void PrepareBones()
        {
            if (!m_BoneGizmoView.CanLayout())
            {
                return;
            }

            if (m_BoneGizmoView.IsActionHot(BoneGizmoAction.None))
            {
                m_CachedBones.Clear();
            }

            m_BoneData.Clear();

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

                PrepareBones(skinComponent);
            }
        }
        public void Setup()
        {
            var go = new GameObject("TestObject");

            m_SkinnedSprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Temp/bird.png");
            m_SpriteSkin    = go.AddComponent <SpriteSkin>();
            m_SpriteSkin.spriteRenderer.sprite = m_SkinnedSprite;
            m_SpriteSkin.CreateBoneHierarchy();

            m_BoneGizmoView = Substitute.For <IBoneGizmoView>();
            m_BoneGizmoView.IsBoneVisible(Arg.Any <Transform>(), Arg.Any <float>(), Arg.Any <float>()).Returns(x => { return(true); });
            m_BoneGizmoView.IsActionHot(BoneGizmoAction.None).Returns(x => { return(true); });
            m_BoneGizmoView.CanLayout().Returns(x => { return(true); });

            m_UndoObject      = Substitute.For <IUndoObject>();
            m_BoneGizmoToggle = Substitute.For <IBoneGizmoToggle>();
            m_BoneGizmoToggle.enableGizmos.Returns(x => { return(true); });

            m_BoneGizmoController = new BoneGizmoController(m_BoneGizmoView, m_UndoObject, m_BoneGizmoToggle);
        }