Exemple #1
0
        public Background(RoomBase room, Int32 columns, Int32 rows, String asset, Int32 assetColumns, Int32 assetRows, Int32 tileWidth, Int32 tileHeight)
        {
            if (room == null)
                throw new ArgumentNullException();

            Initialize(room, columns, rows, asset, assetColumns, assetRows, tileWidth, tileHeight);
        }
Exemple #2
0
 public void GoToRoom(CreateRoomDelegate factory)
 {
     PreviousRoom = CurrentRoom;
     if (PreviousRoom != null)
         CleanupPreviousRoom();
     CurrentRoom = factory(this);
     ReturnRoom = null;
 }
Exemple #3
0
        public Actor(RoomBase room, String spriteSrc, Vector2 position, Single mass, Single damping)
            : base(position, mass, damping)
        {
            if (room == null)
                throw new ArgumentNullException();
            if (String.IsNullOrWhiteSpace(spriteSrc))
                throw new ArgumentNullException();

            Room = room;

            Initialize(spriteSrc);
        }
Exemple #4
0
 public void ReturnToRoom()
 {
     PreviousRoom = CurrentRoom;
     CurrentRoom = ReturnRoom;
     ReturnRoom = null;
 }
Exemple #5
0
 public void GoToRoomThenReturn(CreateRoomDelegate factory, RoomBase returnRoom)
 {
     PreviousRoom = CurrentRoom;
     CurrentRoom = factory(this);
     ReturnRoom = returnRoom;
 }
Exemple #6
0
 private void InitializeRooms()
 {
     PreviousRoom = null;
     CurrentRoom = null;
     ReturnRoom = null;
 }
Exemple #7
0
        private void CleanupRooms()
        {
            if (PreviousRoom != null)
            {
                PreviousRoom.Dispose();
                PreviousRoom = null;
            }

            if (CurrentRoom != null)
            {
                CurrentRoom.Dispose();
                CurrentRoom = null;
            }

            if (ReturnRoom != null)
            {
                ReturnRoom.Dispose();
                ReturnRoom = null;
            }
        }
Exemple #8
0
        private void Initialize(RoomBase room, Int32 columns, Int32 rows, String asset, Int32 assetColumns, Int32 assetRows, Int32 tileWidth, Int32 tileHeight)
        {
            Room = room;

            Asset = asset;
            AssetColumns = assetColumns;
            AssetRows = assetRows;
            AssetTileWidth = tileWidth;
            AssetTileHeight = tileHeight;

            Columns = columns;
            Rows = rows;

            Width = Columns * AssetTileWidth;
            Height = Rows * AssetTileHeight;

            InitializeSpriteList();
            InitializeSprites();
            InitializeTiles();
        }