/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> public void AddBone(Skeleton skeleton, Vector2 position, float length) { AddBone(skeleton, -1, position, length); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="parentIndex">The index of the parent bone.</param> public void AddBone(Skeleton skeleton, int parentIndex) { AddBone(skeleton, parentIndex, 1); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> public void AddBone(Skeleton skeleton, int parentIndex, Vector2 position, float length) { AddBone(skeleton, "", parentIndex, position, length, Vector2.Zero); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="position">The position of the bone.</param> public void AddBone(Skeleton skeleton, Vector2 position) { AddBone(skeleton, position, 1); }
/// <summary> /// Load an animation. /// </summary> /// <param name="skeleton">The skeleton that houses the animation.</param> /// <param name="name">The name of the animaion.</param> private void LoadAnimation(Skeleton skeleton, string name) { //Load the animation. Helper.LoadAnimation(skeleton, _ContentManager.RootDirectory + @"\" + name); //Update the animation bars. UpdateAnimationLists(); //_AnimationBars.SetAnimation(_Animation); //Update the animation list. UpdateAnimationLists(); }
/// <summary> /// Create the event used when a skeleton has been wrapped up in something. /// </summary> /// <param name="skeleton">The skeleton.</param> public SkeletonEventArgs(Skeleton skeleton) { //Pass along the data. _Skeleton = skeleton; }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="spritePath">The path of the sprite to attach to the bone.</param> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="origin">The origin of the sprite to attach to the bone.</param> /// <param name="rotationOffset">The bone sprite's rotation offset.</param> public void AddBone(Skeleton skeleton, string spritePath, int parentIndex, Vector2 position, float length, Vector2 origin, float rotationOffset) { AddBone(skeleton, "", spritePath, -1, parentIndex, position, length, 0, Vector2.One, origin, rotationOffset); }
/// <summary> /// Create a bone. /// </summary> /// <param name="skeleton">The skeleton this bone is a part of.</param> /// <param name="name">The name of the bone.</param> /// <param name="index">The index of the bone.</param> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="startPosition">The starting position of the bone.</param> /// <param name="endPosition">The ending position of the bone.</param> public Bone(Skeleton skeleton, string name, int index, int parentIndex, Vector2 startPosition, Vector2 endPosition) { Initialize(skeleton, name, index, parentIndex, startPosition, endPosition); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="spritePath">The path of the sprite to attach to the bone.</param> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="origin">The origin of the sprite to attach to the bone.</param> public void AddBone(Skeleton skeleton, string spritePath, int parentIndex, float length, Vector2 origin) { AddBone(skeleton, spritePath, parentIndex, length, origin, 0); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="name">The name of the bone.</param> /// <param name="spritePath">The path of the sprite to attach to the bone.</param> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="origin">The origin of the sprite to attach to the bone.</param> public void AddBone(Skeleton skeleton, string name, string spritePath, int parentIndex, Vector2 position, float length, Vector2 origin) { AddBone(skeleton, name, spritePath, -1, parentIndex, position, length, 0, Vector2.One, origin, 0); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="spritePath">The path of the sprite to attach to the bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="origin">The origin of the sprite to attach to the bone.</param> public void AddBone(Skeleton skeleton, string spritePath, Vector2 position, float length, Vector2 origin) { AddBone(skeleton, spritePath, -1, position, length, origin); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="skeleton">The skeleton that the bone will belong to.</param> /// <param name="name">The name of the bone.</param> /// <param name="index">The index of the bone.</param> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="scale">The scale of the bone.</param> /// <param name="rotation">The rotation of the bone.</param> public void AddBone(Skeleton skeleton, string name, int index, int parentIndex, Vector2 position, Vector2 scale, float rotation, float length) { AddBone(skeleton, name, "", index, parentIndex, position, length, rotation, scale, Vector2.Zero, 0); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="skeleton">The skeleton that the bone will belong to.</param> /// <param name="index">The index of the bone.</param> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="scale">The scale of the bone.</param> /// <param name="rotation">The rotation of the bone.</param> public void AddBone(Skeleton skeleton, int index, int parentIndex, Vector2 position, Vector2 scale, float rotation, float length) { AddBone(skeleton, "", index, parentIndex, position, scale, rotation, length); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="length">The length of the bone.</param> public void AddBone(Skeleton skeleton, int parentIndex, float length) { AddBone(skeleton, parentIndex, Vector2.Zero, length); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="skeleton">The skeleton to add the bone to.</param> /// <param name="name">The name of the bone.</param> /// <param name="spritePath">The path of the sprite to attach to the bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="rotation">The rotation of the bone.</param> /// <param name="origin">The origin of the sprite to attach to the bone.</param> public void AddBone(Skeleton skeleton, string name, string spritePath, Vector2 position, float length, float rotation, Vector2 origin) { AddBone(skeleton, name, spritePath, position, length, rotation, origin, 0); }
/// <summary> /// Initialize the bone. /// </summary> /// <param name="skeleton">The skeleton this bone is a part of.</param> /// <param name="name">The name of the bone.</param> /// <param name="index">The index of the bone.</param> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="startPosition">The starting position of the bone.</param> /// <param name="endPosition">The ending position of the bone.</param> private void Initialize(Skeleton skeleton, string name, int index, int parentIndex, Vector2 startPosition, Vector2 endPosition) { //Save the given index for future use, along with initializing a few things. _Skeleton = skeleton; _Name = name; _Index = index; _ParentIndex = parentIndex; _StartPosition = startPosition; _EndPosition = endPosition; _Transform = Matrix.Identity; _TransformedPosition = Vector2.Zero; _TransformedRotation = 0; }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="skeleton">The skeleton to add the bone to.</param> /// <param name="name">The name of the bone.</param> /// <param name="spritePath">The path of the sprite to attach to the bone.</param> /// <param name="parentIndex">The index of the parent.</param> /// <param name="length">The length of the bone.</param> /// <param name="rotation">The rotation of the bone.</param> /// <param name="origin">The origin of the sprite to attach to the bone.</param> /// <param name="rotationOffset">The bone sprite's rotation offset.</param> public void AddBone(Skeleton skeleton, string name, string spritePath, int parentIndex, float length, float rotation, Vector2 origin, float rotationOffset) { AddBone(skeleton, name, spritePath, -1, parentIndex, Vector2.Zero, length, rotation, Vector2.One, origin, rotationOffset); }
/// <summary> /// Set this keyframe to the state of a skeleton. /// </summary> /// <param name="skeleton">The skeleton to mimick.</param> public void SetBones(Skeleton skeleton) { //Clear the list of bones. _BonesToBe.Clear(); //Add all bones in the skeleton to the keyframe. foreach (Bone bone in skeleton.Bones) { AddBone(bone.DeepClone()); } }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="skeleton">The skeleton to add the bone to.</param> /// <param name="name">The name of the bone.</param> /// <param name="spritePath">The path of the sprite to attach to the bone.</param> /// <param name="index">The index of the bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="rotation">The rotation of the bone.</param> /// <param name="scale">The scale of the bone.</param> /// <param name="origin">The origin of the sprite to attach to the bone.</param> /// <param name="rotationOffset">The bone sprite's rotation offset.</param> public void AddBone(Skeleton skeleton, string name, string spritePath, int index, Vector2 position, float length, float rotation, Vector2 scale, Vector2 origin, float rotationOffset) { AddBone(skeleton, name, spritePath, index, -1, position, length, rotation, scale, origin, rotationOffset); }
/// <summary> /// Save the skeleton. /// </summary> /// <param name="skeleton">The skeleton to save.</param> private void SaveSkeleton(Skeleton skeleton) { //Save the skeleton. Helper.SaveSkeleton(skeleton, (_ContentManager.RootDirectory + @"\Editor\")); }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="skeleton">The skeleton to add the bone to.</param> /// <param name="name">The name of the bone.</param> /// <param name="spritePath">The path of the sprite to attach to the bone.</param> /// <param name="index">The index of the bone.</param> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="position">The position of the bone.</param> /// <param name="length">The length of the bone.</param> /// <param name="rotation">The rotation of the bone.</param> /// <param name="scale">The scale of the bone.</param> /// <param name="origin">The origin of the sprite to attach to the bone.</param> /// <param name="rotationOffset">The bone sprite's rotation offset.</param> public void AddBone(Skeleton skeleton, string name, string spritePath, int index, int parentIndex, Vector2 position, float length, float rotation, Vector2 scale, Vector2 origin, float rotationOffset) { //Add the bone. skeleton.AddBone(new Bone(skeleton, name, index, parentIndex, position, Helper.CalculateOrbitPosition(position, rotation, length))); //If a sprite name has been received, attach a sprite to the bone. if (!spritePath.Equals("")) { Factory.Instance.AddSprite(skeleton.Sprites, name, spritePath, position, 0, Vector2.One, 0, 0, 0, (skeleton.Bones.Count - 1).ToString(), origin); skeleton.Sprites.Find(name).RotationOffset = rotationOffset; } }
/// <summary> /// Initialize the character. /// </summary> /// <param name="level">The level that this item belongs to.</param> /// <param name="name">The name of the item.</param> /// <param name="position">The position of the item.</param> /// <param name="rotation">The rotation of the item.</param> /// <param name="scale">The scale of the item.</param> /// <param name="width">The width of the item.</param> /// <param name="height">The height of the item.</param> protected override void Initialize(Level level, string name, Vector2 position, float rotation, Vector2 scale, float width, float height) { //Call the base method. base.Initialize(level, name, position, rotation, scale, width, height); //Initialize a few variables. _Skeleton = new Skeleton(level.GraphicsDevice); _Type = Enums.ItemType.Character; }
/// <summary> /// Add a bone to a skeleton. /// </summary> /// <param name="parentIndex">The index of the parent bone.</param> /// <param name="position">The position of the bone.</param> public void AddBone(Skeleton skeleton, int parentIndex, Vector2 position) { AddBone(skeleton, parentIndex, position, 1); }