示例#1
0
 private void ReplaceTile(Vector3 position, QuadTileData brush, float height)
 {
     if (GetTiles().ContainsKey(position.ToVector2IntXZ()))
     {
         GetTiles()[position.ToVector2IntXZ()].Init(brush, height);
     }
 }
示例#2
0
        public void AddTile(Vector3 position, QuadTileData brush, float height)
        {
            if (GetTiles().ContainsKey(position.ToVector2IntXZ()))
            {
                ReplaceTile(position, brush, height);
                return;
            }

            QuadTile newTile = Instantiate(tilePrefab, position, tilePrefab.transform.rotation, transform);

            newTile.Init(brush, height);
            newTile.gameObject.SetLayerRecursively(LayerMask.NameToLayer("Ignore Editor"));

            GetTiles().Add(position.ToVector2IntXZ(), newTile);
        }
示例#3
0
 public void UpdateSelectionMaterials(QuadTileData data, Color color)
 {
     top.sharedMaterial.SetTexture("_BaseMap", data.top.GetTexture("_BaseMap"));
     top.sharedMaterial.SetColor("_BaseColor", color);
     sideLayers.ForEach(x => x.SetSelectionMaterial(data.sides, color));
 }
示例#4
0
 private void UpdateMaterials(QuadTileData data)
 {
     tileData           = data;
     top.sharedMaterial = data.top;
     sideLayers.ForEach(x => x.SetMaterials(data.sides));
 }
示例#5
0
 public void Init(QuadTileData brush, float height)
 {
     tileData    = brush;
     this.height = height;
     RefreshTile();
 }