Exemplo n.º 1
0
 public void Blend(Coord coord)
 {
     PopulatePiecesInfo();
     foreach (CardinalPoint direction in Util.ListCardinalPoints())
     {
         Coord neighbourCoord = coord + direction;
         if (!pieces.ContainsKey(neighbourCoord))
         {
             if (pieces.ContainsKey(coord))
             {
                 pieces[coord].tile.SetWall(direction, WallType.simple);
             }
         }
         else
         {
             WallTile neighbourTile = pieces[neighbourCoord].tile
                                      .GetWall(Util.Opposite(direction));
             if (neighbourTile.CurrentType == WallType.simple ||
                 neighbourTile.CurrentType == WallType.none)
             {
                 neighbourTile.SetType(pieces.ContainsKey(coord)?
                                       WallType.none : WallType.simple);
             }
         }
     }
 }
Exemplo n.º 2
0
        public void SetState(BuildingTileState state)
        {
            foreach (Transform child in transform.Find("walls"))
            {
                WallTile      wall    = child.GetComponent <WallTile>();
                CardinalPoint wallPos = (CardinalPoint)CardinalPoint.
                                        Parse(typeof(CardinalPoint), wall.name);
                wall.SetState(state.walls[(int)wallPos]);
            }

            ceilingLight.SetActive(state.ceilingLight.exists);
            ceilingLight.Toggle(state.ceilingLight.isOn);
            transform.localPosition = state.localPosition;
        }
Exemplo n.º 3
0
        public BuildingTileState GetState()
        {
            BuildingTileState state = new BuildingTileState();

            foreach (Transform child in transform.Find("walls"))
            {
                WallTile      wall    = child.GetComponent <WallTile>();
                CardinalPoint wallPos = (CardinalPoint)CardinalPoint.
                                        Parse(typeof(CardinalPoint), wall.name);
                state.walls[(int)wallPos] = wall.GetState();
            }

            state.ceilingLight.exists = ceilingLight.isActive;
            state.ceilingLight.isOn   = ceilingLight.isOn;
            state.localPosition       = transform.localPosition;

            return(state);
        }
Exemplo n.º 4
0
        public void ShuffleWall(CardinalPoint wallPos)
        {
            WallTile wall = GetWall(wallPos);

            wall.Shuffle();
        }