コード例 #1
0
ファイル: Entity.cs プロジェクト: LaudableBauble/Bedlam
        /// <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;
        }
コード例 #2
0
ファイル: Box.cs プロジェクト: LaudableBauble/Bedlam
        /// <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;
        }
コード例 #3
0
ファイル: Factory.cs プロジェクト: LaudableBauble/Bedlam
 /// <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);
 }