Beispiel #1
0
 public bool AddTile(Point2 tilePoint, TileData prefab)
 {
     if (this[tilePoint.X, tilePoint.Y] == null) return false;
     if (AddTile(tilePoint, prefab.TileType))
     {
         this[tilePoint.X, tilePoint.Y].Transform.localScale = prefab.Transform.localScale;
         this[tilePoint.X, tilePoint.Y].Transform.rotation = prefab.Transform.rotation;
         return true;
     }
     else
         return false;
 }
Beispiel #2
0
        public TileData Clone()
        {
            TileData newTile = (TileData)MemberwiseClone();

            return(newTile);
        }
Beispiel #3
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;
        }
Beispiel #4
0
        public bool IsTileEmpty(Point2 tilePoint)
        {
            TileData tileData = this[tilePoint.X, tilePoint.Y];

            return(tileData == null || tileData.TileType.IsNullOrIdZero());
        }