Пример #1
0
        /// <summary>
        /// Clone the texture item.
        /// </summary>
        /// <returns>A clone of this texture item.</returns>
        public override Item Clone()
        {
            //Create the clone.
            TextureItem clone = new TextureItem(_Level, _Name, _Position, _Rotation, _Scale);

            //Clone the properties.
            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.Sprites = _Sprites.Clone();

            //Return the clone.
            return clone;
        }
Пример #2
0
        /// <summary>
        /// Add a texture item to a layer.
        /// </summary>
        /// <param name="layer">The layer to add the item to.</param>
        /// <param name="spritePath">The name of the item's sprite.</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>
        public TextureItem AddTextureItem(Layer layer, string spritePath, string name, Vector2 position, float rotation, Vector2 scale)
        {
            //The item.
            TextureItem item = new TextureItem(layer.Level, name, position, rotation, scale);
            item.AddSprite(spritePath);

            //Add the item and return it.
            return (layer.AddItem(item) as TextureItem);
        }