Esempio n. 1
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public BaseTileData()
        {
            name			= "";
            type			= null;
            tileset			= null;
            sheetLocation	= Point2I.Zero;
            properties		= new Properties(this);
            events			= new ObjectEventCollection();

            properties.Set("id", "");
            properties.SetDocumentation("id", "ID", "", "", "General",
                "The id used to refer to this tile.");

            properties.Set("enabled", true);
            properties.SetDocumentation("enabled", "Enabled", "", "", "General",
                "True if the tile is spawned upon entering the room.");

            properties.Set("sprite_index", 0);
            properties.SetDocumentation("sprite_index", "Sprite Index", "sprite_index", "", "Internal",
                "The current sprite in the sprite list to draw.");

            properties.Set("substrip_index", 0);
            properties.SetDocumentation("substrip_index", "Animation Substrip Index", "", "", "Internal",
                "The index of the substrip for dynamic animations.", true, true);
        }
 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public BaseTileDataInstance()
 {
     room				= null;
     tileData			= null;
     properties			= new Properties(this);
     modifiedProperties	= new Properties(this);
 }
Esempio n. 3
0
        public Level(string name, int width, int height, int layerCount, Point2I roomSize, Zone zone)
        {
            this.world			= null;
            this.roomSize		= roomSize;
            this.roomLayerCount = layerCount;
            this.dimensions		= Point2I.Zero;
            //this.zone			= zone;

            properties = new Properties(this);
            properties.BaseProperties = new Properties();

            properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "", "The id used to refer to this level.", false, true);

            properties.BaseProperties.Set("dungeon", "")
                .SetDocumentation("Dungeon", "dungeon", "", "", "The dungeon this level belongs to.");
            properties.BaseProperties.Set("dungeon_floor", 0)
                .SetDocumentation("Dungeon Floor", "", "", "", "The floor in the dungeon this level belongs to.");

            properties.BaseProperties.Set("discovered", false);

            properties.Set("id", name);

            properties.BaseProperties.Set("zone", "")
                .SetDocumentation("Zone", "zone", "", "", "The zone type for this room.", true, false);

            Zone = zone;

            Resize(new Point2I(width, height));
        }
Esempio n. 4
0
 public BaseTileData(BaseTileData copy)
 {
     type				= copy.type;
     tileset				= copy.tileset;
     sheetLocation		= copy.sheetLocation;
     properties			= new Properties();
     properties.SetAll(copy.properties);
 }
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 public CustomPropertyDescriptor(PropertyDocumentation documentation, UITypeEditor editor, Property property, Properties modifiedProperties)
     : base(documentation == null ? property.Name : documentation.ReadableName, null)
 {
     this.documentation		= documentation;
     this.editor				= editor;
     this.property			= property;
     this.modifiedProperties	= modifiedProperties;
 }
 public void AddProperties(Properties properties)
 {
     foreach (Property property in  properties.GetAllProperties()) {
         PropertyDocumentation doc = property.GetDocumentation();
         if (doc == null || !doc.IsHidden)
             propertyList.Add(property);
     }
 }
 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public EventTileDataInstance()
 {
     this.room				= null;
     this.position			= Point2I.Zero;
     this.data				= null;
     this.modifiedProperties	= new Properties();
     this.modifiedProperties.PropertyObject = this;
 }
 public BaseTileDataInstance(BaseTileData tileData)
 {
     this.room		= null;
     this.tileData	= tileData;
     this.properties	= new Properties(this);
     this.properties.BaseProperties = tileData.Properties;
     this.modifiedProperties	= new Properties(this);
     this.modifiedProperties.BaseProperties = tileData.Properties;
 }
Esempio n. 9
0
 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public TileDataInstance()
 {
     this.room		= null;
     this.location	= Point2I.Zero;
     this.layer		= 0;
     this.tileData	= null;
     this.properties = new Properties();
     this.properties.PropertyObject = this;
 }
Esempio n. 10
0
 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public EventTile()
 {
     roomControl		= null;
     eventData		= null;
     position		= Vector2F.Zero;
     size			= Point2I.One;
     properties		= new Properties();
     collisionBox	= new Rectangle2I(0, 0, 16, 16);
 }
 public EventTileDataInstance(EventTileData tileData, Point2I position)
 {
     this.room				= null;
     this.position			= position;
     this.data				= tileData;
     this.modifiedProperties	= new Properties();
     this.modifiedProperties.PropertyObject = this;
     this.modifiedProperties.BaseProperties = tileData.Properties;
 }
Esempio n. 12
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public World()
        {
            this.levels = new List<Level>();
            this.properties = new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            this.properties.BaseProperties.Set("id", "world_name")
                .SetDocumentation("ID", "", "", "The id used to refer to this world.", true, false);
        }
Esempio n. 13
0
 public TileDataInstance(TileData tileData, int x, int y, int layer)
 {
     this.room		= null;
     this.location	= new Point2I(x, y);
     this.layer		= layer;
     this.tileData	= tileData;
     this.properties = new Properties();
     this.properties.PropertyObject = this;
     this.properties.BaseProperties = tileData.Properties;
 }
Esempio n. 14
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public EventTileData()
        {
            type				= null;
            sprite				= null;
            position			= Point2I.Zero;
            size				= Point2I.One;
            properties			= new Properties();

            properties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this event.", true, false);
        }
Esempio n. 15
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public World()
        {
            this.levels = new List<Level>();
            this.scriptManager = new ScriptManager();

            this.properties = new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            this.dungeons = new Dictionary<string, Dungeon>();

            this.properties.BaseProperties.Set("id", "world_name")
                .SetDocumentation("ID", "", "", "", "The id used to refer to this world.", false, true);
        }
Esempio n. 16
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public Dungeon()
        {
            properties = new Properties();
            properties.BaseProperties = new Properties();
            properties.PropertyObject = this;

            properties.BaseProperties.Set("id",			"");
            properties.BaseProperties.Set("name",		"");
            properties.BaseProperties.Set("small_keys",	0);
            properties.BaseProperties.Set("boss_key",	false);
            properties.BaseProperties.Set("map",		false);
            properties.BaseProperties.Set("compass",	false);
            properties.BaseProperties.Set("color_switch_color", (int) PuzzleColor.Blue);
        }
Esempio n. 17
0
        private TileDataInstance tileData; // The tile data used to create this tile.

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        // Use CreateTile() instead of this constructor.
        protected Tile()
        {
            location		= Point2I.Zero;
            layer			= 0;
            offset			= Point2I.Zero;
            size			= Point2I.One;
            flags			= TileFlags.Default;
            customSprite	= new SpriteAnimation();
            spriteAsObject	= new SpriteAnimation();
            isMoving		= false;
            pushDelay		= 20;
            properties		= new Properties();
            properties.PropertyObject = this;
            tileData		= null;
        }
Esempio n. 18
0
        public Level(int width, int height, Point2I roomSize)
        {
            this.world			= null;
            this.roomSize		= roomSize;
            this.roomLayerCount = GameSettings.DEFAULT_TILE_LAYER_COUNT;
            this.dimensions		= Point2I.Zero;
            this.zone			= Resources.GetResource<Zone>("");
            this.properties		= new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            this.properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this level.", true, false);

            Resize(new Point2I(width, height));
        }
Esempio n. 19
0
        // States.
        /*private MonsterBurnState		stateBurn;
        private MonsterStunState		stateStun;
        private MonsterFallInHoleState	stateFallInHole;
        private MonsterGaleState		stateGale;*/
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public Monster()
        {
            // With player:
            // - Top: 4 overlap
            // - Bottom: 3 overlap?
            // - Sides: 3 overlap

            color = MonsterColor.Red;
            properties = new Properties();

            // Physics.
            Physics.CollisionBox		= new Rectangle2I(-5, -9, 10, 10);
            Physics.SoftCollisionBox	= new Rectangle2I(-6, -11, 12, 11);
            Physics.CollideWithWorld	= true;
            Physics.CollideWithRoomEdge	= true;
            Physics.AutoDodges			= true;
            Physics.HasGravity			= true;
            Physics.IsDestroyedInHoles	= true;

            // Graphics.
            Graphics.DepthLayer			= DepthLayer.Monsters;
            Graphics.DepthLayerInAir	= DepthLayer.InAirMonsters;
            Graphics.DrawOffset			= new Point2I(-8, -14);
            centerOffset				= new Point2I(0, -6);

            // Monster & unit settings.
            knockbackSpeed			= GameSettings.MONSTER_KNOCKBACK_SPEED;
            hurtKnockbackDuration	= GameSettings.MONSTER_HURT_KNOCKBACK_DURATION;
            bumpKnockbackDuration	= GameSettings.MONSTER_BUMP_KNOCKBACK_DURATION;
            hurtInvincibleDuration	= GameSettings.MONSTER_HURT_INVINCIBLE_DURATION;
            hurtFlickerDuration		= GameSettings.MONSTER_HURT_FLICKER_DURATION;
            contactDamage			= 1;
            isGaleable				= true;
            isBurnable				= true;
            isStunnable				= true;
            isKnockbackable			= true;

            softKill = false;

            // Setup default interactions.
            interactionHandlers = new InteractionHandler[(int) InteractionType.Count];
            for (int i = 0; i < (int) InteractionType.Count; i++)
                interactionHandlers[i] = new InteractionHandler();
            SetDefaultReactions();
        }
Esempio n. 20
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public Level(string name, int width, int height, int layerCount, Point2I roomSize, Zone zone)
        {
            this.world			= null;
            this.roomSize		= roomSize;
            this.roomLayerCount = layerCount;
            this.dimensions		= Point2I.Zero;
            this.zone			= zone;
            this.properties		= new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            this.properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this level.", true, false);

            this.properties.Set("id", name);

            Resize(new Point2I(width, height));
        }
Esempio n. 21
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public TileData()
        {
            type				= null;
            size				= Point2I.One;
            flags				= TileFlags.Default;
            spriteList			= new SpriteAnimation[0];
            spriteAsObject		= new SpriteAnimation();
            breakAnimation		= null;
            collisionModel		= null;
            sheetLocation		= Point2I.Zero;
            tileset				= null;
            properties			= new Properties();

            properties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this tile.", true, false);
            properties.Set("sprite_index", 0)
                .SetDocumentation("Sprite Index", "sprite_index", "", "The current sprite in the sprite list to draw.", true, true);
        }
Esempio n. 22
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public Room(Level level, int x, int y)
        {
            this.level		= level;
            this.location	= new Point2I(x, y);
            this.tileData	= new TileDataInstance[level.RoomSize.X, level.RoomSize.Y, level.RoomLayerCount];
            this.eventData	= new List<EventTileDataInstance>();
            this.zone		= null;
            this.properties	= new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            this.properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this room.", true, false);
            this.properties.BaseProperties.Set("music", "")
                .SetDocumentation("Music", "song", "", "The music to play in this room. Select none to choose the default music.", true, false);
            this.properties.BaseProperties.Set("zone", "")
                .SetDocumentation("Zone", "zone", "", "The zone type for this room.", true, false);
        }
Esempio n. 23
0
        public TileData(TileData copy)
            : this()
        {
            type				= copy.type;
            size				= copy.size;
            flags				= copy.flags;
            spriteList			= new SpriteAnimation[copy.spriteList.Length];
            spriteAsObject		= new SpriteAnimation(copy.spriteAsObject);
            breakAnimation		= copy.breakAnimation;
            collisionModel		= copy.collisionModel;
            sheetLocation		= copy.sheetLocation;
            tileset				= copy.tileset;
            properties			= new Properties();

            properties.Merge(copy.properties, true);

            for (int i = 0; i < spriteList.Length; i++)
                spriteList[i] = new SpriteAnimation(copy.spriteList[i]);
        }
Esempio n. 24
0
        private TileDataInstance[,,] tileData; // 3D grid of tile data (x, y, layer)

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public Room(Level level, int x, int y, Zone zone = null)
        {
            this.level		= level;
            this.location	= new Point2I(x, y);
            this.tileData	= new TileDataInstance[level.RoomSize.X, level.RoomSize.Y, level.RoomLayerCount];
            this.eventData	= new List<EventTileDataInstance>();
            //this.zone		= zone;
            this.events		= new ObjectEventCollection();
            this.properties	= new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "", "The id used to refer to this room.", true, false);
            properties.BaseProperties.Set("music", "")
                .SetDocumentation("Music", "song", "", "", "The music to play in this room. Select none to choose the default music.", true, false);
            properties.BaseProperties.Set("zone", "")
                .SetDocumentation("Zone", "zone", "", "", "The zone type for this room.", true, false);

            properties.BaseProperties.Set("discovered", false);
            properties.BaseProperties.Set("hidden_from_map", false);
            properties.BaseProperties.Set("boss_room", false);

            events.AddEvent("event_room_start", "Room Start", "Occurs when the room begins.");
            properties.BaseProperties.Set("event_room_start", "")
                .SetDocumentation("Room Start", "script", "", "Events", "Occurs when the room begins.");

            events.AddEvent("event_all_monsters_dead", "All Monsters Dead", "Occurs when all monsters are dead.");
            properties.BaseProperties.Set("event_all_monsters_dead", "")
                .SetDocumentation("All Monsters Dead", "script", "", "Events", "Occurs when all monsters are dead.");

            // Room Flags:
            // - sidescroll ??? could be in Zone
            // - underwater ??? could be in Zone
            // - discovered
            // - hiddenFromMap
            // - boss
            // - trasure
            // - signal

            /*if (zone != null)
                this.properties.Set("zone", zone.ID);*/
        }
 public virtual void Clone(BaseTileDataInstance copy)
 {
     this.room		= copy.Room;
     this.tileData	= copy.tileData;
     this.properties	= new Properties(this);
     this.properties.BaseProperties = tileData.Properties;
     this.modifiedProperties	= new Properties(this);
     this.modifiedProperties.BaseProperties = tileData.Properties;
     this.properties.SetAll(copy.properties);
 }
Esempio n. 26
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        // Construct a property with the given name and type.
        public Property(string name, PropertyType type = PropertyType.String)
        {
            this.name			= name;
            this.type			= type;
            this.objectValue	= 0;
            this.nextSibling	= null;
            this.firstChild		= null;
            this.documentation	= null;
            this.action			= null;
            this.properties		= null;
            this.baseProperty	= null;

            // Add the property action.
            if (Resources.ExistsResource<PropertyAction>(name))
                this.action = Resources.GetResource<PropertyAction>(name);
        }
Esempio n. 27
0
        // Construct a property as a copy of another.
        public Property(Property copy)
        {
            name			= copy.name;
            type			= copy.type;
            intValue		= copy.intValue;
            floatValue		= copy.floatValue;
            stringValue		= copy.stringValue;
            next			= null;
            firstChild		= null;
            documentation	= null;
            action			= copy.action;
            properties		= null;

            if (copy.firstChild != null)
                firstChild = new Property(copy.firstChild);
            if (copy.next != null)
                next = new Property(copy.next);
            if (copy.documentation != null)
                documentation = new PropertyDocumentation(copy.documentation);
        }
Esempio n. 28
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        // Construct a property with the given name and type.
        public Property(string name, PropertyType type = PropertyType.String)
        {
            this.name			= name;
            this.type			= type;
            this.intValue		= 0;
            this.floatValue		= 0;
            this.stringValue	= "";
            this.next			= null;
            this.firstChild		= null;
            this.documentation	= null;
            this.action			= null;
            this.properties		= null;

            if (Resources.ExistsResource<PropertyAction>(name))
                this.action		= Resources.GetResource<PropertyAction>(name);
        }
Esempio n. 29
0
        // Construct a property as a copy of another.
        public Property(Property copy)
        {
            name			= copy.name;
            type			= copy.type;
            objectValue		= copy.objectValue;
            nextSibling		= null;
            firstChild		= null;
            documentation	= null;
            action			= copy.action;
            properties		= null;
            baseProperty	= null;

            if (copy.firstChild != null)
                firstChild = new Property(copy.firstChild);
            if (copy.nextSibling != null)
                nextSibling = new Property(copy.nextSibling);
            if (copy.documentation != null)
                documentation = new PropertyDocumentation(copy.documentation);
        }
Esempio n. 30
0
 public ZeldaObject()
 {
     properties = new Properties();
     events = new ObjectEventCollection();
 }