protected override void LoadContent()
        {
            skeletonRenderer = new SkeletonRenderer(GraphicsDevice);

            String name = "spineboy";             // "goblins";

            Atlas        atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
            SkeletonJson json  = new SkeletonJson(atlas);

            skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
            if (name == "goblins")
            {
                skeleton.SetSkin("goblingirl");
            }
            skeleton.SetSlotsToBindPose();             // Without this the skin attachments won't be attached. See SetSkin.

            // Define mixing between animations.
            AnimationStateData stateData = new AnimationStateData(skeleton.Data);

            if (name == "spineboy")
            {
                stateData.SetMix("walk", "jump", 0.2f);
                stateData.SetMix("jump", "walk", 0.4f);
            }

            state = new AnimationState(stateData);
            state.SetAnimation("walk", false);
            state.AddAnimation("jump", false);
            state.AddAnimation("walk", true);

            skeleton.RootBone.X = 320;
            skeleton.RootBone.Y = 440;
            skeleton.UpdateWorldTransform();
        }
Ejemplo n.º 2
0
        public SkeletonSpatial(GraphicsDevice device, string contentPath, string skin)
        {
            if (!_registered.TryGetValue(contentPath, out _record))
                _record = Load(device, contentPath);

            _skeleton = new Skeleton(_record.Data);
            _skeleton.SetSkin(skin);
            _skeleton.SetSlotsToBindPose();
        }
Ejemplo n.º 3
0
        protected override void LoadContent()
        {
            skeletonRenderer = new SkeletonRenderer(GraphicsDevice);

            Atlas        atlas = new Atlas("data/goblins.atlas", new XnaTextureLoader(GraphicsDevice));
            SkeletonJson json  = new SkeletonJson(atlas);

            skeleton = new Skeleton(json.ReadSkeletonData("data/goblins.json"));
            skeleton.SetSkin("goblingirl");
            skeleton.SetSlotsToBindPose();             // Without this the skin attachments won't be attached. See SetSkin.
            animation = skeleton.Data.FindAnimation("walk");

            skeleton.RootBone.X = 320;
            skeleton.RootBone.Y = 440;
            skeleton.UpdateWorldTransform();
        }
Ejemplo n.º 4
0
        protected override void LoadContent()
        {
            skeletonRenderer = new SkeletonRenderer(GraphicsDevice);

            String name = "spineboy"; // "goblins";

            Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
            if (name == "goblins") skeleton.SetSkin("goblingirl");
            skeleton.SetSlotsToBindPose(); // Without this the skin attachments won't be attached. See SetSkin.

            // Define mixing between animations.
            AnimationStateData stateData = new AnimationStateData(skeleton.Data);
            if (name == "spineboy") {
                stateData.SetMix("walk", "jump", 0.2f);
                stateData.SetMix("jump", "walk", 0.4f);
            }

            state = new AnimationState(stateData);
            state.SetAnimation("walk", false);
            state.AddAnimation("jump", false);
            state.AddAnimation("walk", true);

            skeleton.RootBone.X = 320;
            skeleton.RootBone.Y = 440;
            skeleton.UpdateWorldTransform();
        }
Ejemplo n.º 5
0
        protected override void LoadContent()
        {
            skeletonRenderer = new SkeletonRenderer(GraphicsDevice);

            Texture2D texture = Util.LoadTexture(GraphicsDevice, "data/goblins.png");
            Atlas atlas = new Atlas("data/goblins.atlas", texture, texture.Width, texture.Height);
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.ReadSkeletonData("data/goblins.json"));
            skeleton.SetSkin("goblingirl");
            skeleton.SetSlotsToBindPose(); // Without this the skin attachments won't be attached. See SetSkin.
            animation = skeleton.Data.FindAnimation("walk");

            skeleton.RootBone.X = 320;
            skeleton.RootBone.Y = 440;
            skeleton.UpdateWorldTransform();
        }
Ejemplo n.º 6
0
        public void LoadContent(ContentManager content, GraphicsDevice graphicsDevice)
        {
            blankTex = content.Load<Texture2D>("blank");

            skeletonRenderer = new SkeletonRenderer(graphicsDevice);
            Atlas atlas = new Atlas(graphicsDevice, Path.Combine(content.RootDirectory, "spinegirl.atlas"));
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.readSkeletonData("spinegirl", File.ReadAllText(Path.Combine(content.RootDirectory, "spinegirl.json"))));
            skeleton.SetSkin("default");
            skeleton.SetSlotsToBindPose();
            Animations.Add("walk", skeleton.Data.FindAnimation("walk"));
            Animations.Add("jump", skeleton.Data.FindAnimation("jump"));
            Animations.Add("crawl", skeleton.Data.FindAnimation("crawl"));
            Animations.Add("fall", skeleton.Data.FindAnimation("fall"));
            Animations.Add("grab", skeleton.Data.FindAnimation("grab"));
            Animations.Add("climb", skeleton.Data.FindAnimation("climb"));
            Animations.Add("turnvalve", skeleton.Data.FindAnimation("turnvalve"));

            skeleton.RootBone.X = Position.X;
            skeleton.RootBone.Y = Position.Y;
            skeleton.RootBone.ScaleX = Scale;
            skeleton.RootBone.ScaleY = Scale;

            skeleton.UpdateWorldTransform();
        }
Ejemplo n.º 7
0
        public void LoadContent(ContentManager content, GraphicsDevice graphicsDevice)
        {
            blankTex = content.Load<Texture2D>("Textures/Blank");

            skeletonRenderer = new SkeletonRenderer(graphicsDevice);

            Atlas atlas = new Atlas(graphicsDevice, System.IO.Path.Combine(content.RootDirectory, "spineboy.atlas"));
            SkeletonJson json = new SkeletonJson(atlas);
            json.Scale = 0.5f;
            skeleton = new Skeleton(json.readSkeletonData("spineboy", File.ReadAllText(System.IO.Path.Combine(content.RootDirectory, "spineboy.json"))));
            skeleton.SetSkin("default");
            skeleton.SetSlotsToBindPose();
            walkAnimation = skeleton.Data.FindAnimation("walk");
            jumpAnimation = skeleton.Data.FindAnimation("jump");
            crawlAnimation = skeleton.Data.FindAnimation("crawl");
            fallAnimation = skeleton.Data.FindAnimation("fall");
            grabAnimation = skeleton.Data.FindAnimation("grab");
            climbAnimation = skeleton.Data.FindAnimation("climb");

            skeleton.RootBone.X = Position.X;
            skeleton.RootBone.Y = Position.Y;
            skeleton.UpdateWorldTransform();
        }
Ejemplo n.º 8
0
        protected override void LoadContent()
        {
            skeletonRenderer = new SkeletonRenderer(GraphicsDevice);
            Atlas atlas = new Atlas(GraphicsDevice, "data/goblins.atlas");
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.readSkeletonData("goblins", File.ReadAllText("data/goblins.json")));
            skeleton.SetSkin("goblingirl");
            skeleton.SetSlotsToBindPose();
            animation = skeleton.Data.FindAnimation("walk");

            skeleton.RootBone.X = 320;
            skeleton.RootBone.Y = 440;
            skeleton.UpdateWorldTransform();
        }
Ejemplo n.º 9
0
        protected override void LoadContent()
        {
            skeletonRenderer = new SkeletonRenderer(GraphicsDevice);

            Atlas atlas = new Atlas("data/goblins.atlas", new XnaTextureLoader(GraphicsDevice));
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.ReadSkeletonData("data/goblins.json"));
            skeleton.SetSkin("goblingirl");
            skeleton.SetSlotsToBindPose(); // Without this the skin attachments won't be attached. See SetSkin.
            skeleton.SetAttachment("left hand item", "spear");
            animation = skeleton.Data.FindAnimation("walk");

            skeleton.RootBone.X = 320;
            skeleton.RootBone.Y = 440;
            skeleton.UpdateWorldTransform();
        }
Ejemplo n.º 10
0
        public void LoadContent(SkeletonRenderer sr, Texture2D bt, Atlas atlas, string json)
        {
            blankTex = bt;
            skeletonRenderer =sr;

            SkeletonJson skjson = new SkeletonJson(atlas);
            skeleton = new Skeleton(skjson.readSkeletonData("robo", json));

            tint = new Color(0.5f + ((float)rand.NextDouble() * 0.5f), 0.5f + ((float)rand.NextDouble() * 0.5f), 0.5f + ((float)rand.NextDouble() * 0.5f));
            skeleton.R = tint.ToVector3().X;
            skeleton.G = tint.ToVector3().Y;
            skeleton.B = tint.ToVector3().Z;

            foreach (Slot s in skeleton.Slots)
            {
                if (s.Data.Name != "melee-item" && s.Data.Name != "projectile-item" && s.Data.Name != "fist-item")
                {
                    s.Data.R = skeleton.R;
                    s.Data.G = skeleton.G;
                    s.Data.B = skeleton.B;
                }
            }

            skeleton.SetSkin("default");
            skeleton.SetSlotsToBindPose();
            Animations.Add("walk", skeleton.Data.FindAnimation("walk"));
            Animations.Add("punch-hold", skeleton.Data.FindAnimation("punch-hold"));
            Animations.Add("punch-release", skeleton.Data.FindAnimation("punch-release"));
            Animations.Add("knockback", skeleton.Data.FindAnimation("knockback"));
            Animations.Add("pickup", skeleton.Data.FindAnimation("pickup"));
            Animations.Add("knockout", skeleton.Data.FindAnimation("knockout"));

            skeleton.RootBone.X = Position.X;
            skeleton.RootBone.Y = Position.Y;
            skeleton.RootBone.ScaleX = Scale;
            skeleton.RootBone.ScaleY = Scale;

            skeleton.UpdateWorldTransform();

            skeleton.FindSlot("fist-item").A = 0f;

            fistSound = AudioController.effects["fist"].CreateInstance();
            fistSound.IsLooped = true;
            fistSound.Volume = 0f;
            fistSound.Pitch = -1f;
            fistSound.Play();
        }
Ejemplo n.º 11
0
        public void LoadContent(ContentManager content, GraphicsDevice graphicsDevice)
        {
            blankTex = content.Load<Texture2D>("blank");

            skeletonRenderer = new SkeletonRenderer(graphicsDevice);
            Atlas atlas = new Atlas(graphicsDevice, "robo/robo.atlas", content);
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.readSkeletonData("robo", File.ReadAllText(Path.Combine(content.RootDirectory, "robo/robo.json"))));
            skeleton.SetSkin("default");
            skeleton.SetSlotsToBindPose();

            //skeleton.FindSlot("melee-item").Attachment = itemAttach;
            //skeleton.SetAttachment("melee-item", "crowbar");

            fistSound = AudioController.effects["fist"].CreateInstance();
            fistSound.IsLooped = true;
            fistSound.Volume = 0f;
            fistSound.Pitch = -1f;
            fistSound.Play();

            Animations.Add("walk", skeleton.Data.FindAnimation("walk"));
            Animations.Add("punch-hold", skeleton.Data.FindAnimation("punch-hold"));
            Animations.Add("punch-release", skeleton.Data.FindAnimation("punch-release"));
            Animations.Add("knockback", skeleton.Data.FindAnimation("knockback"));
            Animations.Add("pickup", skeleton.Data.FindAnimation("pickup"));
            Animations.Add("knockout", skeleton.Data.FindAnimation("knockout"));

            skeleton.RootBone.X = Position.X;
            skeleton.RootBone.Y = Position.Y;
            skeleton.RootBone.ScaleX = Scale;
            skeleton.RootBone.ScaleY = Scale;

            skeleton.UpdateWorldTransform();

            Health = 121f;

            //ItemManager.Instance.Spawn(this);

            //skeleton.SetAttachment("melee-item", null);

            skeleton.FindSlot("fist-item").A = 0f;
        }
Ejemplo n.º 12
0
        public void LoadContent(SkeletonRenderer sr, Atlas atlas, string json)
        {
            //blankTex = bt;
            skeletonRenderer =sr;

            SkeletonJson skjson = new SkeletonJson(atlas);
            skeleton = new Skeleton(skjson.readSkeletonData("robo", json));

            //skeleton.R = Tint.ToVector3().X;
            //skeleton.G = Tint.ToVector3().Y;
            //skeleton.B = Tint.ToVector3().Z;

            Vector3 topColor = ClothesTint().ToVector3();
            Vector3 bottomColor = ClothesTint().ToVector3();
            Vector3 shoesColor = ClothesTint().ToVector3();
            Vector3 skinColor = SkinTone().ToVector3();
            Vector3 hairColor = HairColor().ToVector3();

            if (IsCoPilot)
            {
                topColor = Color.Blue.ToVector3();
                bottomColor = Color.Blue.ToVector3();
                shoesColor = Color.DarkGray.ToVector3();
            }

            foreach (Slot s in skeleton.Slots)
            {
                if (s.Data.Name == "torso" ||
                    s.Data.Name=="arm-back-upper"  ||
                    s.Data.Name == "arm-back-lower" ||
                    s.Data.Name== "arm-upper" ||
                    s.Data.Name =="arm-lower")
                {
                    s.Data.R = topColor.X;
                    s.Data.G = topColor.Y;
                    s.Data.B = topColor.Z;
                }

                if (s.Data.Name == "leg-left" ||
                    s.Data.Name == "leg-right")
                {
                    s.Data.R = bottomColor.X;
                    s.Data.G = bottomColor.Y;
                    s.Data.B = bottomColor.Z;
                }

                if (s.Data.Name == "foot-left" ||
                    s.Data.Name == "foot-right")
                {
                    s.Data.R = shoesColor.X;
                    s.Data.G = shoesColor.Y;
                    s.Data.B = shoesColor.Z;
                }

                if (s.Data.Name == "head" ||
                    s.Data.Name == "hand" ||
                    s.Data.Name == "hand-copy")
                {
                    s.Data.R = skinColor.X;
                    s.Data.G = skinColor.Y;
                    s.Data.B = skinColor.Z;
                }

                if (s.Data.Name == "hair")
                {
                    s.Data.R = hairColor.X;
                    s.Data.G = hairColor.Y;
                    s.Data.B = hairColor.Z;
                }
            }

            skeleton.SetSkin("default");
            skeleton.SetSlotsToBindPose();
            Animations.Add("walk", skeleton.Data.FindAnimation("walk"));
            Animations.Add("punch-hold", skeleton.Data.FindAnimation("punch-hold"));
            Animations.Add("punch-release", skeleton.Data.FindAnimation("punch-release"));
            Animations.Add("knockback", skeleton.Data.FindAnimation("knockback"));
            Animations.Add("pickup", skeleton.Data.FindAnimation("pickup"));
            Animations.Add("knockout", skeleton.Data.FindAnimation("knockout"));
            Animations.Add("panic", skeleton.Data.FindAnimation("panic"));

            skeleton.RootBone.X = Position.X;
            skeleton.RootBone.Y = Position.Y;
            skeleton.RootBone.ScaleX = Scale;
            skeleton.RootBone.ScaleY = Scale;

            skeleton.UpdateWorldTransform();

            skeleton.SetAttachment("melee-item", null);
            skeleton.SetAttachment("hat", (IsCoPilot||IsPlayer)?"Pilot-Hat":null);
            skeleton.SetAttachment("hair", (Helper.Random.Next(2)==0?"Hair-Male":"Hair-Female"));
            skeleton.SetAttachment("chute", null);
            //skeleton.FindSlot("fist-item").A = 0f;

            HasParachute = false;

            State = AIState.Panic;
        }
Ejemplo n.º 13
0
        public void LoadContent(ContentManager content, GraphicsDevice graphicsDevice)
        {
            //blankTex = content.Load<Texture2D>("blank");

            skeletonRenderer = new SkeletonRenderer(graphicsDevice);
            Atlas atlas = new Atlas(graphicsDevice, "dude/dude.atlas", content);
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.readSkeletonData("dude", File.ReadAllText(Path.Combine(content.RootDirectory, "dude/dude.json"))));
            skeleton.SetSkin("default");
            skeleton.SetSlotsToBindPose();

            Color topColor = Color.Navy;
            Color bottomColor = Color.Navy;
            Color shoesColor = Color.DarkGray;
            Vector3 skinColor = SkinTone().ToVector3();
            Vector3 hairColor = HairColor().ToVector3();

            foreach (Slot s in skeleton.Slots)
            {
                if (s.Data.Name == "torso" ||
                    s.Data.Name == "arm-back-upper" ||
                    s.Data.Name == "arm-back-lower" ||
                    s.Data.Name == "arm-upper" ||
                    s.Data.Name == "arm-lower")
                {
                    s.Data.R = topColor.R;
                    s.Data.G = topColor.G;
                    s.Data.B = topColor.B;
                }

                if (s.Data.Name == "leg-left" ||
                    s.Data.Name == "leg-right")
                {
                    s.Data.R = bottomColor.R;
                    s.Data.G = bottomColor.G;
                    s.Data.B = bottomColor.B;
                }

                if (s.Data.Name == "foot-left" ||
                    s.Data.Name == "foot-right")
                {
                    s.Data.R = shoesColor.R;
                    s.Data.G = shoesColor.G;
                    s.Data.B = shoesColor.B;
                }

                if (s.Data.Name == "head" ||
                    s.Data.Name == "hand" ||
                    s.Data.Name == "hand-copy")
                {
                    s.Data.R = skinColor.X;
                    s.Data.G = skinColor.Y;
                    s.Data.B = skinColor.Z;
                }

                if (s.Data.Name == "hair")
                {
                    s.Data.R = hairColor.X;
                    s.Data.G = hairColor.Y;
                    s.Data.B = hairColor.Z;
                }
            }

            skeleton.SetSkin("default");
            skeleton.SetSlotsToBindPose();
            Animations.Add("walk", skeleton.Data.FindAnimation("walk"));
            Animations.Add("punch-hold", skeleton.Data.FindAnimation("punch-hold"));
            Animations.Add("punch-release", skeleton.Data.FindAnimation("punch-release"));
            Animations.Add("knockback", skeleton.Data.FindAnimation("knockback"));
            Animations.Add("pickup", skeleton.Data.FindAnimation("pickup"));
            Animations.Add("knockout", skeleton.Data.FindAnimation("knockout"));
            Animations.Add("panic", skeleton.Data.FindAnimation("panic"));

            skeleton.RootBone.X = Position.X;
            skeleton.RootBone.Y = Position.Y;
            skeleton.RootBone.ScaleX = Scale;
            skeleton.RootBone.ScaleY = Scale;

            skeleton.UpdateWorldTransform();

            skeleton.SetAttachment("melee-item", null);
            skeleton.SetAttachment("hat", (IsCoPilot || IsPlayer) ? "Pilot-Hat" : null);
            skeleton.SetAttachment("hair", (Helper.Random.Next(2) == 0 ? "Hair-Male" : "Hair-Female"));
            skeleton.SetAttachment("chute", null);

            HasParachute = false;

            //skeleton.FindSlot("fist-item").A = 0f;
        }