private void OnGUI() { GUILayout.Label("Tile Texturer", EditorStyles.boldLabel); tileType = (ITileType)EditorGUILayout.EnumPopup("Texture Type", tileType); tilemap = (Tilemap)EditorGUILayout.ObjectField("Tilemap", tilemap, typeof(Tilemap), true); tile = (TileBase)EditorGUILayout.ObjectField("Tile to Replace", tile, typeof(TileBase), false); if (GUILayout.Button("Texturize")) { BoundsInt bounds = tilemap.cellBounds; string tilePrefix = "Assets/Tiles/" + tileType.ToString() + "/Resources/" + tileType.ToString() + "_"; for (int x = 0; x < (int)tileType; x++) { for (int y = 0; y < (int)tileType; y++) { Vector3Int pos = new Vector3Int(x + bounds.xMin, bounds.yMax - y, 0); if (tilemap.GetTile(pos) == tile) { int index = x + y * ((int)tileType + 1); TileBase newTile = (TileBase)EditorGUIUtility.Load(tilePrefix + index + ".asset"); tilemap.SetTile(pos, newTile); } } } } }
private void CreateLandTilesFor6And8() { foreach (int num6Or8 in NumberDistributor.GetListNumbersOf(new List <int>() { 6, 8 })) { int number = num6Or8; ITileType tileType = TileDistributor.GetOneRandomTileTypeOfTypeSort(EnumCoordinateType.Land); Coordinate coordinate = null; bool numberIsntAssignedInTile = true; while (numberIsntAssignedInTile) { coordinate = CoordsDistributor.GetOneRandomCoordinate(EnumCoordinateType.Land); if (!AdjacentsTilesHas6or8(GetAdjacentTiles(coordinate))) { tiles.Add(new LandTile(coordinate, tileType, number)); numberIsntAssignedInTile = false; } else { CoordsDistributor.coords.Add(coordinate); } } } }
public void ChangeTileType(ITileType tiletype, bool rewriteflags) { _TTileType = tiletype; if (rewriteflags) { _TTileFlags = tiletype.Flags; // They're value types... right??? :ohdear: } }
public void UpdateMazeArray(int x, int y, ITileType tileType, ITileType empty) { MazeArray[x, y].TileType = tileType; if (MazeArray[x, y].TileType.Display == empty.Display) { MazeArray[x, y].HasBeenEaten = true; //TODO remove } }
public void ChangeType(ITileType nextType) { if (type.mesh.GetType() == nextType.mesh.GetType()) { mesh = nextType.mesh.Create(mesh, face); } type = nextType; }
public Tile(ITileType tileType) { _TTileType = tileType; _TTileFlags = tileType.Flags; _TTileEntityList = new List <IEntity>(); _TTileFeatureList = new List <ITileFeature>(); _TileHeight = 1; _Render = new TilerIsADummy.PrototypeMapGen.PrototypeComponents.P_TileRenderComponent(this); }
public void AddTileType(ITileType tileType) { if (TileTypes.ContainsKey(tileType.ID)) { throw new ArgumentException($"Attempted to add a tile type with an duplicate tile type ID '{tileType.ID}'"); } TileTypes.Add(tileType.ID, tileType); }
private ITile CreateDesertTile() { ITileType tileType = TileDistributor.GetDesertTileType(); Coordinate coordinate = CoordsDistributor.GetOneRandomCoordinate(EnumCoordinateType.Land); int number = NumberDistributor.Get7FromList(); ITile desertTile = new LandTile(coordinate, tileType, number); return(desertTile); }
/// <summary> /// Gets one tile, and removes it from its total list. /// </summary> /// <returns></returns> public ITileType GetOneRandomTileTypeOfTypeSort(EnumCoordinateType typeSort) { IList <ITileType> sortedListTileType = GetListTileTypesOfTypeSort(typeSort); Random R = new Random(); int randomnumber = R.Next(0, sortedListTileType.Count - 1); ITileType result = sortedListTileType[randomnumber]; RemoveTile(result); return(result); }
public TileTypeMatcher(ITileType defaultTileType) { if (defaultTileType == null) { throw new ArgumentNullException(nameof(defaultTileType)); } TileTypes = new Dictionary <string, ITileType>(); DefaultTileType = defaultTileType; }
public void Initialize(Face face, ITileType type) { this.face = face; this.type = type; mesh = type.mesh.Create(new Mesh(), face); meshFilter = GetComponent <MeshFilter>(); meshFilter.mesh = mesh; }
private List <ITile> CreateRemainingNumbersForTiles() { List <ITile> landTiles = new List <ITile>(); List <int> numbers = NumberDistributor.GetNumbers(); foreach (int number in numbers) { ITileType tileType = TileDistributor.GetOneRandomTileTypeOfTypeSort(EnumCoordinateType.Land); Coordinate coordinate = CoordsDistributor.GetOneRandomCoordinate(EnumCoordinateType.Land); ITile newTile = new LandTile(coordinate, tileType, number); landTiles.Add(newTile); } return(landTiles); }
public ITileType GetDesertTileType() { ITileType result = null; foreach (ITileType type in Tiletypes.ToList()) { if (type.Type == EnumType.Desert) { Tiletypes.Remove(type); result = type; break; } } return(result); }
private void CreateMaze(IReadOnlyList <string> mazeData, ITileType pellet) { Height = mazeData.Count; Width = mazeData[0].Length; MazeArray = new ITile[Height, Width]; var x = 0; foreach (var lineData in mazeData) { var y = 0; foreach (var tileType in lineData.Select(Parser.GetTileType)) { MazeArray[x, y] = new Tile(tileType); if (tileType.Display == pellet.Display) { Pellets++; } y++; } x++; } }
public Tile(ITileType tileType) { TileType = tileType; }
public WaterTile(Coordinate coordinate, ITileType resource) { Coordinate = coordinate; Resource = new WaterTileType(EnumType.Water); }
public WaterTile(Coordinate coordinate, LandTileType resource, int value) { Coordinate = coordinate; Resource = resource; }
private void RemoveTile(ITileType tileType) { Tiletypes.Remove(tileType); }
public void setType(ITileType newType) { type = newType; onTypeChange(); }
public RandomGhostBehaviour(ITileType ghostTile) { _ghostTile = ghostTile; Rng = new Rng(); }
public HarbourTile(Coordinate coordinate, ITileType resource) { Coordinate = coordinate; Resource = resource; }
public MapGenerator(ITileType tiletype) { this._TileType = tiletype; GenerateTileTypeList(); }
public LandTile(Coordinate coordinate, ITileType resource, int value) { Coordinate = coordinate; Resource = resource; Value = value; }
public HarbourTile(Coordinate coordinate, WaterTileType resource, int value) { Coordinate = coordinate; Resource = resource; }
public TileTypeFactory(ITileType wall, ITileType empty, ITileType pellet) { Wall = wall; Empty = empty; Pellet = pellet; }