public void CanAddTileTypeWithoutPrefab()
        {
            LayerData ld = new LayerData(null, "SuperLayer", 1, 1);
            TileType type = new TileType(1);
            Point2 position = new Point2(0, 0);

            bool result = ld.AddTile(position, type);

            Assert.IsTrue(result);
            Assert.IsNotNull(ld[position]);
        }
 public void bob()
 {
     LayerData layer = new LayerData(null, "Layer", 2, 2);
     ArchitectTilePositionGetter tilePosition = new ArchitectTilePositionGetter(Vector3.zero, layer);
     TileType type = new TileType(5);
     ArchitectRotationFlip rotation = new ArchitectRotationFlip(90, false, false);
     BrushCommand brush = new BrushCommand(tilePosition, type, rotation);
     bool done = brush.Do();
     Debug.Log(done);
     Assert.IsTrue(done);
 }
        public void CanAddTileTypeWithPrefab()
        {
            LayerData ld = new LayerData(null, "SuperLayer", 1, 1);
            GameObject go = new GameObject("TestGo");
            TileType type = new TileType(1,go);
            Point2 position = new Point2(0, 0);

            bool result = ld.AddTile(position, type);

            Assert.IsTrue(result);
            Assert.IsNotNull(ld[position]);
            Assert.IsNotNull(ld[position].GameObject);
        }
Esempio n. 4
0
 public TileData(TileType tileType, GameObject gameObject)
 {
     this.TileType = tileType;
     this.GameObject = gameObject;
 }
Esempio n. 5
0
 public void AddTile(Point2 tilePoint, TileType tileType, int rotationFlags)
 {
     if (this[tilePoint.X, tilePoint.Y] == null) return;
     AddTile(tilePoint, tileType);
     ArchitectRotationHandler.ApplyFlipFlags(this[tilePoint.X, tilePoint.Y].Transform, rotationFlags);
 }
Esempio n. 6
0
        public bool AddTile(Point2 tilePoint, TileType tileType)
        {
            if (!InRange(tilePoint)) return false;
            if (tileType == null) return false;

            if (tileType.Prefab != null)
            {
                GameObject newTile = UnityEngine.Object.Instantiate(tileType.Prefab);

                newTile.transform.SetPosition(new Vector3(tilePoint.X, tilePoint.Y, 0));
                newTile.transform.parent = LayerTransform;
                newTile.name = tileType.Prefab.name;
                TileData tileData = new TileData(tileType, newTile);
                this[tilePoint.X, tilePoint.Y] = tileData;
            }
            else
            {
                TileData tileData = new TileData(tileType, null);
                this[tilePoint.X, tilePoint.Y] = tileData;
            }
            return true;
        }
Esempio n. 7
0
 public void AddTile(Point2 tilePoint, TileType tileType, float angle, bool horizontal, bool vertical)
 {
     if (this[tilePoint.X, tilePoint.Y] == null) return;
     AddTile(tilePoint, tileType);
     ArchitectRotationHandler.ApplyRotationFlip(this[tilePoint.X, tilePoint.Y].Transform, angle, horizontal, vertical);
 }
Esempio n. 8
0
 public void AddTile(Point2 tilePoint, TileType tileType, ArchitectRotationFlip rotationFlip)
 {
     if (this[tilePoint.X, tilePoint.Y] == null) return;
     AddTile(tilePoint, tileType);
     rotationFlip.ApplyTo(this[tilePoint.X, tilePoint.Y].Transform);
 }
Esempio n. 9
0
        /*public void setSelectedTile(int id)
        {
            SelectedTileType = Linker.Tilesets[0].Tiles[id - 1];
        }

        public void AddSelectedTileType(LayerData layer, Vector3 worldP, Point2 tilePoint)
        {
            layer.AddTile(tilePoint, toolControler.SelectedTileType, toolControler.RotationFlip);
        }*/
        /*public void AddTile(LayerData layer, Vector3 worldP, Point2 tilePoint, TileType tileType)
        {
            layer.AddTile(tilePoint, tileType, toolControler.RotationFlip);
        }*/
        public void AddTile(LayerData layer, Vector3 worldP, Point2 tilePoint, TileType tileType, ArchitectRotationFlip RotationFlip)
        {
            layer.AddTile(tilePoint, tileType, RotationFlip);
        }