Ejemplo n.º 1
0
 public Weapon(IParent parent, World world, string textureId, Vector2 size, Vector2 rotationOrigin, Color color)
     : base(world, textureId)
 {
     _world = world;
     _character = (Character)parent;
     _spriteRotationOrigin = rotationOrigin;
     Size = size;
     Color = color;
 }
Ejemplo n.º 2
0
        public void GiveAppearanceTo(Character character, float layerDepthOffset)
        {
            character.LeftLeg = CreateLimp(LeftLeg, character);
            character.LeftLeg.LayerDepth += layerDepthOffset;

            character.RightLeg = CreateLimp(RightLeg, character);
            character.RightLeg.LayerDepth += layerDepthOffset;

            character.LeftArm = CreateLimp(LeftArm, character);
            character.LeftArm.LayerDepth += layerDepthOffset;

            character.Head = CreateLimp(Head, character);
            character.Head.LayerDepth += layerDepthOffset;

            character.Body = CreateLimp(Body, character);
            character.Body.LayerDepth += layerDepthOffset;
        }
Ejemplo n.º 3
0
        public Sprite CreateLimp(Limb limb, Character character)
        {
            Sprite result = new Sprite(
                parent: character,
                textureId: limb.TextureId,
                size: limb.Size,
                collidable: false,
                elasticity: 0);

            result.RotationAngle = limb.RotationAngle;
            result.RotationOrigin = limb.RotationOrigin;
            result.LayerDepth = limb.LayerDepth;

            character.Add(result, limb.Position);

            return result;
        }
Ejemplo n.º 4
0
        public static void GiveFriendlyLook(Character character)
        {
            character.LeftLeg = new Sprite(
                parent: character,
                textureId: "leftleg",
                position: new Vector2(1, 32),
                size: new Vector2(9, 15),
                collidable: false,
                elasticity: 0);
            character.LeftLeg.RotationAngle = 0f;
            character.LeftLeg.RotationOrigin = new Vector2(5, 0);

            character.RightLeg = new Sprite(
                parent: character,
                textureId: "rightleg",
                position: new Vector2(5, 32),
                size: new Vector2(9, 15),
                collidable: false,
                elasticity: 0);
            character.RightLeg.RotationAngle = 0f;
            character.RightLeg.RotationOrigin = new Vector2(5, 0);

            character.Body = new Sprite(
                parent: character,
                textureId: "body",
                position: new Vector2(0, 13),
                size: new Vector2(15, 20),
                collidable: false,
                elasticity: 0);

            character.Head = new Sprite(character, "head", new Vector2(1, 0), new Vector2(13, 17), false, 0);
            character.Head.RotationAngle = 0f;
            character.Head.RotationOrigin = new Vector2(7, 16);

            character.LeftArm = new Sprite(character, "leftarm", new Vector2(0, 16), new Vector2(3, 18), false, 0);
            character.LeftArm.RotationAngle = 0f;
            character.LeftArm.RotationOrigin = new Vector2(1.5f, 1);
        }
Ejemplo n.º 5
0
 public void TeleportCharacter(Character character)
 {
     character.Position = LinkedTeleporter.Position;
     character.Position = new Vector2(character.Position.X, character.Position.Y - (character.Bottom - LinkedTeleporter.Bottom));
     LinkedTeleporter.Active = false;
 }