예제 #1
0
        public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
        {
            // Query if we are flagged or not
            MapInformation mapInfo = tilemap.GetComponent <Transform>().gameObject.GetComponentInParent <MapInformation>();

            RevealedState state = mapInfo.GetRevealedStateForSquare(position.x, position.y);

            if (state == RevealedState.Unexplored)
            {
                tileData.sprite = Unexplored;
            }
            else if (state == RevealedState.Flag)
            {
                tileData.sprite = Flag;
            }
        }
예제 #2
0
        public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
        {
            // Query the map information for how many bombs we are touching
            MapInformation mapInfo = tilemap.GetComponent <Transform>().gameObject.GetComponentInParent <MapInformation>();

            int count = mapInfo.GetBombsTouchingSquare(position.x, position.y);

            // Less than zero means we have a bomb
            if (count < 0)
            {
                tileData.sprite = BombSprite;
            }
            else
            {
                tileData.sprite = NumberedSprites[count];
            }
        }
 /// <summary>
 /// Initializes the mouse handler
 /// </summary>
 public void Start()
 {
     m_map  = GetComponent <MapInformation>();
     m_grid = GetComponent <Grid>();
 }