Ejemplo n.º 1
0
        public override void LoadContent()
        {
            mBounds = new SkeletonBounds();

            mSkeleton = SpineDataManager.Instance.NewSkeleton(mName, mScale); //Fixed Scale from here. Main instanciation.
            mSkeleton.SetSlotsToSetupPose();                                  // Without this the skin attachments won't be attached. See SetSkin.
            mAnimationState = SpineDataManager.Instance.NewAnimationState(mSkeleton.Data);
            mSkeleton.X     = mInitPosition.X;
            mSkeleton.Y     = mInitPosition.Y;

            mTextures    = new Texture2D[4];
            mTextures[0] = TextureManager.Instance.GetElementByString(mName);
            mTextures[1] = TextureManager.Instance.GetElementByString(mName + "Normal");
            mTextures[2] = TextureManager.Instance.GetElementByString(mName + "AO");
            mTextures[3] = TextureManager.Instance.GetElementByString(mName + "Depth");

            mSkeleton.FlipY = true;
            //mSkeleton.SetSkin("default");
            mSkeleton.SetSkin("front");
        }
Ejemplo n.º 2
0
        public void LoadContent(ContentLoader content)
        {
            SkeletonBounds = new SkeletonBounds();

            var Loader = Entity.World.Get <SpineTextureLoader>();

            Skeleton = Loader.Load(Image);

            var NormalsImage = Image + "_normals.png";

            if (System.IO.File.Exists(content.RootDirectory + "\\" + NormalsImage))
            {
                NormalMap = content.Load <Texture2D>(NormalsImage);
            }

            UpdateSkeletonEffect();
            SetSkin(Data.Skin);

            AnimationStateData = AnimationStateData ?? new AnimationStateData(Skeleton.Data);

            AnimationMixFn?.Invoke(AnimationStateData);

            if (AnimationState == null)
            {
                AnimationState           = new AnimationState(AnimationStateData);
                AnimationState.Complete += AnimationComplete;
                AnimationState.Event    += AnimationState_Event;
            }

            if (!string.IsNullOrEmpty(AnimationName))
            {
                AnimationState.SetAnimation(0, AnimationName, true);
                AnimationState.Update(AnimationTime);
                AnimationState.Apply(Skeleton);
            }
            AnimationState.End += AnimationState_End;
        }