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; }
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; }
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; }
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); }
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; }