Beispiel #1
0
        public void Next()
        {
            TileBase parent = task.Pop();

            ++currentCount;

            if (parent)
            {
                set.Add(TileBase.HashNameFromPosition(parent.transform.position));
            }
            else
            {
                return;
            }

            foreach (Neighbor i in parent.FindNeighbors(factory))
            {
                Vector3 position = parent.transform.position + i.Offset;

                if (board.ValidPosition(position))
                {
                    if (!set.Contains(TileBase.HashNameFromPosition(position)))
                    {
                        TileBase tileBase = board.Replace(position, i.Tile);
                        tileBase.transform.eulerAngles = new Vector3(0.0f, 0.0f, i.Rotation);

                        task.Push(tileBase);
                    }
                }
            }
        }
Beispiel #2
0
 public TileBase GetTile(Vector3 position)
 {
     if (map.ContainsKey(TileBase.HashNameFromPosition(position)))
     {
         return(map[TileBase.HashNameFromPosition(position)]);
     }
     else
     {
         return(null);
     }
 }
Beispiel #3
0
 public bool ValidPosition(Vector3 position)
 {
     return(map.ContainsKey(TileBase.HashNameFromPosition(position)));
 }
Beispiel #4
0
 public TileBase Replace(Vector3 position, TileBase tile)
 {
     Destroy(map[TileBase.HashNameFromPosition(position)].gameObject);
     return(Place(position, tile));
 }