コード例 #1
0
    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);
                    }
                }
            }
        }
    }
コード例 #2
0
        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);
                    }
                }
            }
        }
コード例 #3
0
 public void ChangeTileType(ITileType tiletype, bool rewriteflags)
 {
     _TTileType = tiletype;
     if (rewriteflags)
     {
         _TTileFlags = tiletype.Flags;                 // They're value types... right??? :ohdear:
     }
 }
コード例 #4
0
ファイル: Maze.cs プロジェクト: cindymxcai/Pacman
 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
     }
 }
コード例 #5
0
 public void ChangeType(ITileType nextType)
 {
     if (type.mesh.GetType() == nextType.mesh.GetType())
     {
         mesh = nextType.mesh.Create(mesh, face);
     }
     type = nextType;
 }
コード例 #6
0
 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);
 }
コード例 #7
0
ファイル: TileTypeMatcher.cs プロジェクト: Porl91/BridgeGame
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
ファイル: TileDistributor.cs プロジェクト: TimWilms/Catan
        /// <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);
        }
コード例 #10
0
ファイル: TileTypeMatcher.cs プロジェクト: Porl91/BridgeGame
        public TileTypeMatcher(ITileType defaultTileType)
        {
            if (defaultTileType == null)
            {
                throw new ArgumentNullException(nameof(defaultTileType));
            }

            TileTypes       = new Dictionary <string, ITileType>();
            DefaultTileType = defaultTileType;
        }
コード例 #11
0
    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;
    }
コード例 #12
0
        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);
        }
コード例 #13
0
ファイル: TileDistributor.cs プロジェクト: TimWilms/Catan
        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);
        }
コード例 #14
0
ファイル: Maze.cs プロジェクト: cindymxcai/Pacman
        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++;
            }
        }
コード例 #15
0
ファイル: Tile.cs プロジェクト: cindymxcai/Pacman
 public Tile(ITileType tileType)
 {
     TileType = tileType;
 }
コード例 #16
0
ファイル: WaterTile.cs プロジェクト: TimWilms/Catan
 public WaterTile(Coordinate coordinate, ITileType resource)
 {
     Coordinate = coordinate;
     Resource   = new WaterTileType(EnumType.Water);
 }
コード例 #17
0
ファイル: WaterTile.cs プロジェクト: TimWilms/Catan
 public WaterTile(Coordinate coordinate, LandTileType resource, int value)
 {
     Coordinate = coordinate;
     Resource   = resource;
 }
コード例 #18
0
ファイル: TileDistributor.cs プロジェクト: TimWilms/Catan
 private void RemoveTile(ITileType tileType)
 {
     Tiletypes.Remove(tileType);
 }
コード例 #19
0
ファイル: Tile.cs プロジェクト: NCEghtebas/Bezultian
 public void setType(ITileType newType)
 {
     type = newType;
     onTypeChange();
 }
コード例 #20
0
 public RandomGhostBehaviour(ITileType ghostTile)
 {
     _ghostTile = ghostTile;
     Rng        = new Rng();
 }
コード例 #21
0
ファイル: HarbourTile.cs プロジェクト: TimWilms/Catan
 public HarbourTile(Coordinate coordinate, ITileType resource)
 {
     Coordinate = coordinate;
     Resource   = resource;
 }
コード例 #22
0
 public MapGenerator(ITileType tiletype)
 {
     this._TileType = tiletype;
     GenerateTileTypeList();
 }
コード例 #23
0
ファイル: LandTile.cs プロジェクト: TimWilms/Catan
 public LandTile(Coordinate coordinate, ITileType resource, int value)
 {
     Coordinate = coordinate;
     Resource   = resource;
     Value      = value;
 }
コード例 #24
0
ファイル: HarbourTile.cs プロジェクト: TimWilms/Catan
 public HarbourTile(Coordinate coordinate, WaterTileType resource, int value)
 {
     Coordinate = coordinate;
     Resource   = resource;
 }
コード例 #25
0
 public TileTypeFactory(ITileType wall, ITileType empty, ITileType pellet)
 {
     Wall   = wall;
     Empty  = empty;
     Pellet = pellet;
 }