/// <summary> /// Add a limb to the entity. /// </summary> /// <param name="limb">The limb to add.</param> /// <returns>The added limb.</returns> public Limb AddLimb(Limb limb) { //Add the limb to the list. _Limbs.Add(limb); //Return the limb. return limb; }
/// <summary> /// Clone the box. /// </summary> /// <returns>A clone of this box.</returns> public override Item Clone() { //Create the clone. Box clone = new Box(); //Clone the properties. clone.Sprites = _Sprites.Clone(); clone.Limbs = new List<Limb>(); clone.Level = _Level; clone.Name = _Name; clone.Position = _Position; clone.Rotation = _Rotation; clone.Scale = _Scale; clone.Width = _Width; clone.Height = _Height; clone.IsVisible = _IsVisible; clone.Origin = _Origin; clone._Type = _Type; //Clone the limbs. foreach (Limb limb in _Limbs) { //Create the cloned limb. Limb lClone = new Limb(); lClone.Body = limb.Body.DeepClone(); //Match the limb's sprites to the cloned ones. foreach (Sprite sprite in limb.Sprites) { lClone.AddSprite(clone.Sprites[_Sprites.IndexOf(sprite)]); } //Add the cloned limb. clone.AddLimb(lClone); } //Return the clone. return clone; }
/// <summary> /// Add a limb to an entity. /// </summary> /// <param name="entity">The destination entity.</param> /// <param name="limb">The limb to add.</param> /// <returns>The recently added limb.</returns> public Limb AddLimb(Entity entity, Limb limb) { return entity.AddLimb(limb); }