예제 #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);
        }
예제 #2
0
 public void GoToRoom(CreateRoomDelegate factory)
 {
     PreviousRoom = CurrentRoom;
     if (PreviousRoom != null)
         CleanupPreviousRoom();
     CurrentRoom = factory(this);
     ReturnRoom = null;
 }
예제 #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);
        }
예제 #4
0
 public void ReturnToRoom()
 {
     PreviousRoom = CurrentRoom;
     CurrentRoom = ReturnRoom;
     ReturnRoom = null;
 }
예제 #5
0
 public void GoToRoomThenReturn(CreateRoomDelegate factory, RoomBase returnRoom)
 {
     PreviousRoom = CurrentRoom;
     CurrentRoom = factory(this);
     ReturnRoom = returnRoom;
 }
예제 #6
0
 private void InitializeRooms()
 {
     PreviousRoom = null;
     CurrentRoom = null;
     ReturnRoom = null;
 }
예제 #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;
            }
        }
예제 #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();
        }