Exemplo n.º 1
0
 /// <summary>
 /// Adds the level to the map's Levels and Scripts.
 /// </summary>
 /// <param name="levelName">The level name without an extension.</param>
 public void AddLevel(string levelName)
 {
     string[] levels  = new string[Levels.Length + 1];
     string[] scripts = new string[Scripts.Length + 1];
     Levels.CopyTo(levels, 0);
     Scripts.CopyTo(scripts, 0);
     levels[^ 1]  = levelName + Program.LevelFileExtension;
Exemplo n.º 2
0
        /// <summary>
        /// Creates a perfect copy of this entity.
        /// </summary>
        /// <returns>A copy of the Entity.</returns>
        public Entity Copy()
        {
            Entity ent = new Entity(Type)
            {
                X = X, Y = Y, Layer = Layer, Visible = Visible
            };

            if (Type == EntityType.Person)
            {
                string[] strings = new string[5];
                Scripts.CopyTo(strings);
                ent.Name = Name;
                ent.Scripts.Clear();
                ent.Scripts.AddRange(strings);
                ent.Spriteset = Spriteset;
                ent._graphic  = new Bitmap(Resources.PersonIcon);
            }
            else if (Type == EntityType.Trigger)
            {
                ent.Function = Function;
                ent._graphic = new Bitmap(Resources.TriggerIcon);
            }
            return(ent);
        }