Exemplo n.º 1
0
		private static void SetMapValuesToBlocked(LevelTileType[] mapData, int startRow, int endRow,
			int startCol, int endCol)
		{
			for (int x = startRow; x < endRow; x++)
				for (int y = startCol; y < endCol; y++)
					SetTile(mapData, x, y, LevelTileType.Blocked);
		}
Exemplo n.º 2
0
 public LevelTile(LevelTileType type, bool isBackground)
 {
     this.prefab       = default(GameObject);
     this.color        = default(Color);
     this.type         = type;
     this.isBackground = isBackground;
 }
Exemplo n.º 3
0
		public static LevelTileType[] MapInfo(Size gridSize)
		{
			size = gridSize;
			var mapData = new LevelTileType[(int)(BathRoomLevelInfo.size.Width * BathRoomLevelInfo.size.Height)];
			for (int i = 0; i < mapData.Length; i++)
				mapData[i] = LevelTileType.Nothing;

			//walls and emoty grid spaces
			SetMapValuesToBlocked(mapData, 0, 0, 0, 23);
			SetMapValuesToBlocked(mapData, 12, 13, 0, 23);
			SetMapValuesToBlocked(mapData, 1, 1, 17, 23);
			SetMapValuesToBlocked(mapData, 11, 11, 0, 6);

			SetTile(mapData, 9, 0, LevelTileType.Blocked);
			SetTile(mapData, 10, 0, LevelTileType.Blocked);
			SetTile(mapData, 11, 0, LevelTileType.Blocked);
			SetTile(mapData, 11, 12, LevelTileType.Blocked);

			//towel shelf
			SetTile(mapData, 6, 8, LevelTileType.Blocked);
			SetTile(mapData, 7, 8, LevelTileType.Blocked);
			SetTile(mapData, 8, 8, LevelTileType.Blocked);
			SetTile(mapData, 6, 9, LevelTileType.Blocked);
			SetTile(mapData, 7, 9, LevelTileType.Blocked);
			SetTile(mapData, 8, 9, LevelTileType.Blocked);

			//plant
			SetTile(mapData, 2, 23, LevelTileType.Blocked);

			//toilet
			SetTile(mapData, 1, 14, LevelTileType.Blocked);

			//towels
			SetTile(mapData, 3, 4, LevelTileType.Blocked);
			SetTile(mapData, 4, 5, LevelTileType.Blocked);

			SetTile(mapData, 5, 15, LevelTileType.Blocked);
			SetTile(mapData, 7, 16, LevelTileType.Blocked);
			SetTile(mapData, 9, 14, LevelTileType.Blocked);

			//stools
			SetTile(mapData, 4, 20, LevelTileType.Blocked);
			SetTile(mapData, 2, 10, LevelTileType.Blocked);

			//toilet paper
			SetTile(mapData, 5, 14, LevelTileType.Blocked);

			//spawn points
			SetTile(mapData, 2, 1, LevelTileType.SpawnPoint);

			//Exit Points
			SetTile(mapData, 7, 23, LevelTileType.ExitPoint);

			//Tower Placeable Points
			SetTile(mapData, 3, 7, LevelTileType.Yellow); //impact tower
			SetTile(mapData, 6, 13, LevelTileType.Red); //fire tower
			SetTile(mapData, 8, 20, LevelTileType.Blue); //water tower
			return mapData;
		}
Exemplo n.º 4
0
		public static LevelTileType[] MapInfo()
		{
			var mapData = new LevelTileType[(int)(Size.Width * Size.Height)];
			for (int i = 0; i < mapData.Length; i++)
				mapData[i] = LevelTileType.Nothing;

			// walls and empty grid spaces
			SetMapValuesToBlocked(mapData, 0, 24, 0, 2);
			SetMapValuesToBlocked(mapData, 0, 24, 24, 26);
			SetMapValuesToBlocked(mapData, 16, 23, 2, 4);
			SetMapValuesToBlocked(mapData, 18, 23, 4, 8);
			SetMapValuesToBlocked(mapData, 21, 23, 8, 12);
			SetMapValuesToBlocked(mapData, 21, 23, 19, 24);
			SetMapValuesToBlocked(mapData, 18, 21, 22, 24);
			SetMapValuesToBlocked(mapData, 1, 7, 21, 24);
			SetMapValuesToBlocked(mapData, 1, 4, 19, 21);
			SetMapValuesToBlocked(mapData, 1, 8, 2, 10);

			SetTile(mapData, 5, 8, LevelTileType.Nothing);
			SetTile(mapData, 6, 8, LevelTileType.Nothing);
			SetTile(mapData, 7, 8, LevelTileType.Nothing);
			SetTile(mapData, 5, 9, LevelTileType.Nothing);
			SetTile(mapData, 6, 9, LevelTileType.Nothing);
			SetTile(mapData, 7, 9, LevelTileType.Nothing);

			SetMapValuesToBlocked(mapData, 8, 17, 22, 24); // tv stand
			SetMapValuesToBlocked(mapData, 22, 23, 12, 15); // book rack to right
			SetMapValuesToBlocked(mapData, 1, 2, 14, 18); //book shelf
			SetMapValuesToBlocked(mapData, 13, 15, 17, 19); // small couch in middle
			SetMapValuesToBlocked(mapData, 13, 15, 2, 4); // small couch at top
			SetMapValuesToBlocked(mapData, 13, 15, 12, 16); // table
			SetMapValuesToBlocked(mapData, 9, 11, 13, 18); // vertical couch
			SetMapValuesToBlocked(mapData, 11, 15, 9, 11); // horizontal couch
			SetMapValuesToBlocked(mapData, 3, 5, 8, 10); // chair near wall

			//standing objects
			SetTile(mapData, 10, 10, LevelTileType.Blocked); // book stand near couch
			SetTile(mapData, 10, 18, LevelTileType.Blocked); // stand near couch
			SetTile(mapData, 22, 17, LevelTileType.Blocked); // tree pot near bookshelf
			SetTile(mapData, 15, 3, LevelTileType.Blocked); // tree pot near wall
			SetTile(mapData, 7, 7, LevelTileType.Blocked); // lamp near wall
			SetTile(mapData, 20, 8, LevelTileType.Blocked); // lamp near chair
			SetTile(mapData, 19, 9, LevelTileType.Blocked); // chair to left
			SetTile(mapData, 9, 12, LevelTileType.Blocked); // chair near couch

			//ball
			SetTile(mapData, 18, 8, LevelTileType.Blocked);
			SetTile(mapData, 9, 8, LevelTileType.Blocked);

			// spawn points
			SetTile(mapData, 1, 9, LevelTileType.SpawnPoint);
			SetTile(mapData, 8, 3, LevelTileType.SpawnPoint);

			// exit points
			SetTile(mapData, 19, 20, LevelTileType.ExitPoint);

			return mapData;
		}
		public static LevelTileType[] MapInfo()
		{
			var mapData = new LevelTileType[(int)(Size.Width * Size.Height)];
			for (int i = 0; i < mapData.Length; i++)
				mapData[i] = LevelTileType.Nothing;

			// walls and empty grid spaces
			SetMapValuesToBlocked(mapData, 0, 24, 0, 2);
			SetMapValuesToBlocked(mapData, 0, 24, 24, 26);
			SetMapValuesToBlocked(mapData, 16, 23, 2, 4);
			SetMapValuesToBlocked(mapData, 18, 23, 4, 8);
			SetMapValuesToBlocked(mapData, 21, 23, 8, 12);
			SetMapValuesToBlocked(mapData, 21, 23, 19, 24);
			SetMapValuesToBlocked(mapData, 18, 21, 22, 24);
			SetMapValuesToBlocked(mapData, 1, 7, 21, 24);
			SetMapValuesToBlocked(mapData, 1, 4, 19, 21);
			SetMapValuesToBlocked(mapData, 1, 8, 2, 10);

			SetTile(mapData, 5, 8, LevelTileType.Nothing);
			SetTile(mapData, 6, 8, LevelTileType.Nothing);
			SetTile(mapData, 7, 8, LevelTileType.Nothing);
			SetTile(mapData, 5, 9, LevelTileType.Nothing);
			SetTile(mapData, 6, 9, LevelTileType.Nothing);
			SetTile(mapData, 7, 9, LevelTileType.Nothing);

			SetMapValuesToBlocked(mapData, 8, 17, 22, 24); // tv stand
			SetMapValuesToBlocked(mapData, 22, 23, 12, 15); // book rack to right
			SetMapValuesToBlocked(mapData, 1, 2, 14, 18); //book shelf
			SetMapValuesToBlocked(mapData, 13, 15, 17, 19); // small couch in middle
			SetMapValuesToBlocked(mapData, 13, 15, 2, 4); // small couch at top
			SetMapValuesToBlocked(mapData, 13, 15, 12, 16); // table
			SetMapValuesToBlocked(mapData, 9, 11, 13, 18); // vertical couch
			SetMapValuesToBlocked(mapData, 11, 15, 9, 11); // horizontal couch
			SetMapValuesToBlocked(mapData, 3, 5, 8, 10); // chair near wall

			//standing objects
			SetTile(mapData, 10, 10, LevelTileType.Blocked); // book stand near couch
			SetTile(mapData, 10, 18, LevelTileType.Blocked); // stand near couch
			SetTile(mapData, 22, 17, LevelTileType.Blocked); // tree pot near bookshelf
			SetTile(mapData, 15, 3, LevelTileType.Blocked); // tree pot near wall
			SetTile(mapData, 7, 7, LevelTileType.Blocked); // lamp near wall
			SetTile(mapData, 20, 8, LevelTileType.Blocked); // lamp near chair
			SetTile(mapData, 19, 9, LevelTileType.Blocked); // chair to left
			SetTile(mapData, 9, 12, LevelTileType.Blocked); // chair near couch

			//ball
			SetTile(mapData, 18, 8, LevelTileType.Blocked);
			SetTile(mapData, 9, 8, LevelTileType.Blocked);

			// spawn points
			SetTile(mapData, 1, 9, LevelTileType.SpawnPoint);
			SetTile(mapData, 8, 3, LevelTileType.SpawnPoint);

			// exit points
			SetTile(mapData, 19, 20, LevelTileType.ExitPoint);

			return mapData;
		}
Exemplo n.º 6
0
 // Draw a rectangle to the board.
 public void DrawRect(RectInt rect, LevelTileType tileType)
 {
     for (int x = rect.x; x < rect.x + rect.width; x++)
     {
         for (int y = rect.y; y < rect.y + rect.height; y++)
         {
             level[x, y].type = tileType;
         }
     }
 }
Exemplo n.º 7
0
			public void FindPath(LevelTileType typeOfStartTile)
			{
				Vector2D startPoint = FindTile(typeOfStartTile);
				if (startPoint.Equals(Vector2D.Unused))
					throw new StartPointNotFound();
				var tileCoordinates = new Vector2D[Width * Height];
				for (int lineIndex = 0; lineIndex < Height; lineIndex++)
					for (int symbolIndex = 0; symbolIndex < Width; symbolIndex++)
						tileCoordinates[symbolIndex + lineIndex * Width] = new Vector2D(symbolIndex, lineIndex);
			}
Exemplo n.º 8
0
		private void AddPoints(XmlData xml, LevelTileType pointType)
		{
			int counter = 0;
			foreach (var point in FindPoints(pointType))
			{
				var pointXml = new XmlData(pointType.ToString());
				pointXml.AddAttribute("Name", pointType.ToString().Replace("Point", "") + (counter++));
				pointXml.AddAttribute("Position", point);
				xml.AddChild(pointXml);
			}
		}
Exemplo n.º 9
0
		private IEnumerable<Vector2D> FindPoints(LevelTileType pointType)
		{
			var result = new List<Vector2D>();
			for (int y = 0; y < Level.Size.Height; y++)
				for (int x = 0; x < Level.Size.Width; x++)
				{
					var index = (int)(x + y * Level.Size.Width);
					if (Level.MapData[index] == pointType)
						result.Add(new Vector2D(x, y));
				}
			return result;
		}
Exemplo n.º 10
0
        private void AddPoints(XmlData xml, LevelTileType pointType)
        {
            int counter = 0;

            foreach (var point in FindPoints(pointType))
            {
                var pointXml = new XmlData(pointType.ToString());
                pointXml.AddAttribute("Name", pointType.ToString().Replace("Point", "") + (counter++));
                pointXml.AddAttribute("Position", point);
                xml.AddChild(pointXml);
            }
        }
Exemplo n.º 11
0
    public Tile GetTileFromType(LevelTileType type)
    {
        foreach (TileDef t in tileDefs)
        {
            if (t.type == type)
            {
                return(t.tile);
            }
        }

        return(tileDefs[0].tile);
    }
Exemplo n.º 12
0
 public void SetTile(Vector2D gridPosition, LevelTileType selectedTileType)
 {
     if (gridPosition.X >= 0 && gridPosition.Y >= 0 && gridPosition.X < mapSize.Width &&
         gridPosition.Y < mapSize.Height)
     {
         int index = GetIndexForMapData(gridPosition);
         MapData[index] = selectedTileType;
         if (TileChanged != null)
         {
             TileChanged(gridPosition);
         }
     }
 }
Exemplo n.º 13
0
        public void SetTileWithScreenPosition(Vector2D screenPosition, LevelTileType selectedTileType)
        {
            var position = GetIntersectionWithFloor(screenPosition);

            if (position != null && RenderIn3D)
            {
                SetTile(GetMapCoordinates(new Vector2D(position.Value.X, position.Value.Y)),
                        selectedTileType);
            }
            else
            {
                SetTile(GetTileIndex(screenPosition), selectedTileType);
            }
        }
Exemplo n.º 14
0
 private Vector2D FindTile(LevelTileType typeOfTile)
 {
     for (int lineIndex = 0; lineIndex < Height; lineIndex++)
     {
         for (int symbolIndex = 0; symbolIndex < Width; symbolIndex++)
         {
             if (mapData[lineIndex * Width + symbolIndex].Type == typeOfTile)
             {
                 return(new Vector2D(lineIndex, symbolIndex));
             }
         }
     }
     return(Vector2D.Unused);
 }
Exemplo n.º 15
0
        public Color GetColor(LevelTileType tileType)
        {
            switch (tileType)
            {
            case LevelTileType.Blocked:
                return(Color.LightGray);

            case LevelTileType.Placeable:
                return(Color.CornflowerBlue);

            case LevelTileType.BlockedPlaceable:
                return(Color.LightBlue);

            case LevelTileType.Red:
                return(Color.Red);

            case LevelTileType.Green:
                return(Color.Green);

            case LevelTileType.Blue:
                return(Color.Blue);

            case LevelTileType.Yellow:
                return(Color.Yellow);

            case LevelTileType.Brown:
                return(Color.Brown);

            case LevelTileType.Gray:
                return(Color.Gray);

            case LevelTileType.LightBlue:
                return(Color.LightBlue);

            case LevelTileType.SpawnPoint:
                return(Color.PaleGreen);

            case LevelTileType.ExitPoint:
                return(Color.DarkGreen);

            case LevelTileType.NoSelection:
                return(Color.TransparentBlack);

            default:
                return(Color.Black);
            }
        }
Exemplo n.º 16
0
        public List <Vector2D> GetAllTilesOfType(LevelTileType tileType)
        {
            var list = new List <Vector2D>();

            for (int x = 0; x < Size.Width; x++)
            {
                for (int y = 0; y < Size.Height; y++)
                {
                    var index = (int)(x + y * Size.Width);
                    if (MapData[index] == tileType)
                    {
                        list.Add(GetWorldCoordinates(new Vector2D(x, y)));
                    }
                }
            }
            return(list);
        }
Exemplo n.º 17
0
        private IEnumerable <Vector2D> FindPoints(LevelTileType pointType)
        {
            var result = new List <Vector2D>();

            for (int y = 0; y < level.Size.Height; y++)
            {
                for (int x = 0; x < level.Size.Width; x++)
                {
                    var index = (int)(x + y * level.Size.Width);
                    if (level.MapData[index] == pointType)
                    {
                        result.Add(new Vector2D(x, y));
                    }
                }
            }
            return(result);
        }
Exemplo n.º 18
0
            public void FindPath(LevelTileType typeOfStartTile)
            {
                Vector2D startPoint = FindTile(typeOfStartTile);

                if (startPoint.Equals(Vector2D.Unused))
                {
                    throw new StartPointNotFound();
                }
                var tileCoordinates = new Vector2D[Width * Height];

                for (int lineIndex = 0; lineIndex < Height; lineIndex++)
                {
                    for (int symbolIndex = 0; symbolIndex < Width; symbolIndex++)
                    {
                        tileCoordinates[symbolIndex + lineIndex * Width] = new Vector2D(symbolIndex, lineIndex);
                    }
                }
            }
Exemplo n.º 19
0
        private static char TileToLetterType(LevelTileType tileType)
        {
            switch (tileType)
            {
            case LevelTileType.Nothing:
                return('.');

            case LevelTileType.Blocked:
                return('X');

            case LevelTileType.Placeable:
                return('P');

            case LevelTileType.BlockedPlaceable:
                return('L');

            case LevelTileType.Red:
                return('R');

            case LevelTileType.Green:
                return('G');

            case LevelTileType.Blue:
                return('B');

            case LevelTileType.Yellow:
                return('Y');

            case LevelTileType.Brown:
                return('O');

            case LevelTileType.Gray:
                return('A');

            case LevelTileType.SpawnPoint:
                return('S');

            case LevelTileType.ExitPoint:
                return('E');

            default:
                throw new ArgumentOutOfRangeException("tileType");                 //ncrunch: no coverage
            }
        }
        public static LevelTileType[] MapInfo()
        {
            var mapData = new LevelTileType[(int)(Size.Width * Size.Height)];

            for (int i = 0; i < mapData.Length; i++)
            {
                mapData[i] = LevelTileType.Placeable;
            }

            //walls and emoty grid spaces
            SetMapValuesToBlocked(mapData, 0, 15, 0, 4);
            SetMapValuesToBlocked(mapData, 0, 15, 13, 15);
            SetMapValuesToBlocked(mapData, 0, 2, 0, 15);
            SetMapValuesToBlocked(mapData, 13, 15, 0, 15);

            SetTile(mapData, 12, 3, LevelTileType.Blocked);
            SetTile(mapData, 12, 4, LevelTileType.Blocked);
            SetTile(mapData, 12, 10, LevelTileType.Blocked);
            SetTile(mapData, 12, 11, LevelTileType.Blocked);
            SetTile(mapData, 12, 12, LevelTileType.Blocked);
            SetTile(mapData, 11, 12, LevelTileType.Blocked);

            //pillows
            SetTile(mapData, 10, 4, LevelTileType.Blocked);
            SetTile(mapData, 10, 5, LevelTileType.Blocked);

            //ball
            SetTile(mapData, 9, 8, LevelTileType.Blocked);

            //boxes
            SetTile(mapData, 5, 10, LevelTileType.Blocked);
            SetTile(mapData, 5, 11, LevelTileType.Blocked);

            //spawn points
            SetTile(mapData, 7, 3, LevelTileType.SpawnPoint);

            //Exit Points
            SetTile(mapData, 7, 13, LevelTileType.ExitPoint);
            SetTile(mapData, 8, 13, LevelTileType.ExitPoint);
            return(mapData);
        }
Exemplo n.º 21
0
		public static LevelTileType[] MapInfo()
		{
			var mapData = new LevelTileType[(int)(Size.Width * Size.Height)];
			for (int i = 0; i < mapData.Length; i++)
				mapData[i] = LevelTileType.Placeable;

			//walls and emoty grid spaces
			SetMapValuesToBlocked(mapData, 0, 15, 0, 4);
			SetMapValuesToBlocked(mapData, 0, 15, 13, 15);
			SetMapValuesToBlocked(mapData, 0, 2, 0, 15);
			SetMapValuesToBlocked(mapData, 13, 15, 0, 15);

			SetTile(mapData, 12, 3, LevelTileType.Blocked);
			SetTile(mapData, 12, 4, LevelTileType.Blocked);
			SetTile(mapData, 12, 10, LevelTileType.Blocked);
			SetTile(mapData, 12, 11, LevelTileType.Blocked);
			SetTile(mapData, 12, 12, LevelTileType.Blocked);
			SetTile(mapData, 11, 12, LevelTileType.Blocked);

			//pillows
			SetTile(mapData, 10, 4, LevelTileType.Blocked);
			SetTile(mapData, 10, 5, LevelTileType.Blocked);

			//ball
			SetTile(mapData, 9, 8, LevelTileType.Blocked);

			//boxes
			SetTile(mapData, 5, 10, LevelTileType.Blocked);
			SetTile(mapData, 5, 11, LevelTileType.Blocked);

			//spawn points
			SetTile(mapData, 7, 3, LevelTileType.SpawnPoint);

			//Exit Points
			SetTile(mapData, 7, 13, LevelTileType.ExitPoint);
			SetTile(mapData, 8, 13, LevelTileType.ExitPoint);
			return mapData;
		}
Exemplo n.º 22
0
		private static void SetTile(LevelTileType[] mapData, int x, int y, LevelTileType tileType)
		{
			mapData[(int)(x + y * size.Width)] = tileType;
		}
Exemplo n.º 23
0
 // Constructor
 public AStarTile(Vector2Int newPos)
 {
     pos  = newPos;
     type = LevelTileType.Empty;
     ResetPath();
 }
Exemplo n.º 24
0
 public static LevelTile Room(LevelTileType type = LevelTileType.Normal) => new LevelTile
 {
     Type = type
 };
Exemplo n.º 25
0
 public LevelTile(Vector2D position, LevelTileType type)
 {
     Position = position;
     Type     = type;
 }
Exemplo n.º 26
0
        public static LevelTileType[] MapInfo(Size gridSize)
        {
            size = gridSize;
            var mapData = new LevelTileType[(int)(BathRoomLevelInfo.size.Width * BathRoomLevelInfo.size.Height)];

            for (int i = 0; i < mapData.Length; i++)
            {
                mapData[i] = LevelTileType.Nothing;
            }

            //walls and emoty grid spaces
            SetMapValuesToBlocked(mapData, 0, 0, 0, 23);
            SetMapValuesToBlocked(mapData, 12, 13, 0, 23);
            SetMapValuesToBlocked(mapData, 1, 1, 17, 23);
            SetMapValuesToBlocked(mapData, 11, 11, 0, 6);

            SetTile(mapData, 9, 0, LevelTileType.Blocked);
            SetTile(mapData, 10, 0, LevelTileType.Blocked);
            SetTile(mapData, 11, 0, LevelTileType.Blocked);
            SetTile(mapData, 11, 12, LevelTileType.Blocked);

            //towel shelf
            SetTile(mapData, 6, 8, LevelTileType.Blocked);
            SetTile(mapData, 7, 8, LevelTileType.Blocked);
            SetTile(mapData, 8, 8, LevelTileType.Blocked);
            SetTile(mapData, 6, 9, LevelTileType.Blocked);
            SetTile(mapData, 7, 9, LevelTileType.Blocked);
            SetTile(mapData, 8, 9, LevelTileType.Blocked);

            //plant
            SetTile(mapData, 2, 23, LevelTileType.Blocked);

            //toilet
            SetTile(mapData, 1, 14, LevelTileType.Blocked);

            //towels
            SetTile(mapData, 3, 4, LevelTileType.Blocked);
            SetTile(mapData, 4, 5, LevelTileType.Blocked);

            SetTile(mapData, 5, 15, LevelTileType.Blocked);
            SetTile(mapData, 7, 16, LevelTileType.Blocked);
            SetTile(mapData, 9, 14, LevelTileType.Blocked);

            //stools
            SetTile(mapData, 4, 20, LevelTileType.Blocked);
            SetTile(mapData, 2, 10, LevelTileType.Blocked);

            //toilet paper
            SetTile(mapData, 5, 14, LevelTileType.Blocked);

            //spawn points
            SetTile(mapData, 2, 1, LevelTileType.SpawnPoint);

            //Exit Points
            SetTile(mapData, 7, 23, LevelTileType.ExitPoint);

            //Tower Placeable Points
            SetTile(mapData, 3, 7, LevelTileType.Yellow);           //impact tower
            SetTile(mapData, 6, 13, LevelTileType.Red);             //fire tower
            SetTile(mapData, 8, 20, LevelTileType.Blue);            //water tower
            return(mapData);
        }
Exemplo n.º 27
0
		public CompleteSquare(LevelTileType type, int distanceCosts = 100, bool isPath = false)
			: this()
		{
			Type = type;
		}
Exemplo n.º 28
0
 public CompleteSquare(LevelTileType type, int distanceCosts = 100, bool isPath = false)
     : this()
 {
     Type = type;
 }
Exemplo n.º 29
0
 public UnsupportedTileType(LevelTileType tileType)
     : base(tileType.ToString())
 {
 }
Exemplo n.º 30
0
		public Color GetColor(LevelTileType tileType)
		{
			switch (tileType)
			{
			case LevelTileType.Blocked:
				return Color.LightGray;
			case LevelTileType.Placeable:
				return Color.CornflowerBlue;
			case LevelTileType.BlockedPlaceable:
				return Color.LightBlue;
			case LevelTileType.Red:
				return Color.Red;
			case LevelTileType.Green:
				return Color.Green;
			case LevelTileType.Blue:
				return Color.Blue;
			case LevelTileType.Yellow:
				return Color.Yellow;
			case LevelTileType.Brown:
				return Color.Brown;
			case LevelTileType.Gray:
				return Color.Gray;
			case LevelTileType.LightBlue:
				return Color.LightBlue;
			case LevelTileType.SpawnPoint:
				return Color.PaleGreen;
			case LevelTileType.ExitPoint:
				return Color.DarkGreen;
			case LevelTileType.NoSelection:
				return Color.TransparentBlack;
			default:
				return Color.Black;
			}
		}
Exemplo n.º 31
0
		public List<Vector2D> GetAllTilesOfType(LevelTileType tileType)
		{
			var list = new List<Vector2D>();
			for (int x = 0; x < Size.Width; x++)
				for (int y = 0; y < Size.Height; y++)
				{
					var index = (int)(x + y * Size.Width);
					if (MapData[index] == tileType)
						list.Add(GetWorldCoordinates(new Vector2D(x, y)));
				}
			return list;
		}
Exemplo n.º 32
0
			private Vector2D FindTile(LevelTileType typeOfTile)
			{
				for (int lineIndex = 0; lineIndex < Height; lineIndex++)
					for (int symbolIndex = 0; symbolIndex < Width; symbolIndex++)
						if (mapData[lineIndex * Width + symbolIndex].Type == typeOfTile)
							return new Vector2D(lineIndex, symbolIndex);
				return Vector2D.Unused;
			}
Exemplo n.º 33
0
			public UnsupportedTileType(LevelTileType tileType)
				: base(tileType.ToString()) {}
Exemplo n.º 34
0
 private static void SetTile(LevelTileType[] mapData, int x, int y, LevelTileType tileType)
 {
     mapData[(int)(x + y * size.Width)] = tileType;
 }
Exemplo n.º 35
0
		private static char TileToLetterType(LevelTileType tileType)
		{
			switch (tileType)
			{
			case LevelTileType.Nothing:
				return '.';
			case LevelTileType.Blocked:
				return 'X';
			case LevelTileType.Placeable:
				return 'P';
			case LevelTileType.BlockedPlaceable:
				return 'L';
			case LevelTileType.Red:
				return 'R';
			case LevelTileType.Green:
				return 'G';
			case LevelTileType.Blue:
				return 'B';
			case LevelTileType.Yellow:
				return 'Y';
			case LevelTileType.Brown:
				return 'O';
			case LevelTileType.Gray:
				return 'A';
			case LevelTileType.SpawnPoint:
				return 'S';
			case LevelTileType.ExitPoint:
				return 'E';
			default:
				throw new ArgumentOutOfRangeException("tileType"); //ncrunch: no coverage
			}
		}
Exemplo n.º 36
0
			public LevelTile(Vector2D position, LevelTileType type)
			{
				Position = position;
				Type = type;
			}
Exemplo n.º 37
0
		public void SetTile(Vector2D gridPosition, LevelTileType selectedTileType)
		{
			if (gridPosition.X >= 0 && gridPosition.Y >= 0 && gridPosition.X < mapSize.Width &&
				gridPosition.Y < mapSize.Height)
			{
				int index = GetIndexForMapData(gridPosition);
				MapData[index] = selectedTileType;
				if (TileChanged != null)
					TileChanged(gridPosition);
			}
		}
Exemplo n.º 38
0
 private Room GetRoomPrefab(LevelTileType type) =>
 type switch
 {
Exemplo n.º 39
0
		public void SetTileWithScreenPosition(Vector2D screenPosition, LevelTileType selectedTileType)
		{
			var position = GetIntersectionWithFloor(screenPosition);
			if (position != null && RenderIn3D)
				SetTile(GetMapCoordinates(new Vector2D(position.Value.X, position.Value.Y)),
					selectedTileType);
			else
				SetTile(GetTileIndex(screenPosition), selectedTileType);
		}