Esempio n. 1
0
        public bool CheckNextStep(int tile)
        {
            bool OkToStep = false;

            if (AllowedTiles.Contains(tile))
            {
                OkToStep = true;
            }

            return(OkToStep);
        }
Esempio n. 2
0
    public IEnumerable <Vector3Int> Neighbors(Vector3Int node)
    {
        var directions = (node.y % 2 == 0 ? directions_when_y_is_even : directions_when_y_is_odd);

        foreach (var direction in directions)
        {
            Vector3Int neighborPos  = node + direction;
            TileBase   neighborTile = tilemap.GetTile(neighborPos);
            Debug.Log(node + " --> " + neighborPos);
            if (allowedTiles.Contains(neighborTile))
            {
                yield return(neighborPos);
            }
        }
    }
Esempio n. 3
0
    void Update()
    {
        Vector3  newPosition       = NewPosition();
        TileBase tileOnNewPosition = TileOnPosition(newPosition);

        if (allowedTiles.Contains(tileOnNewPosition))
        {
            transform.position = newPosition;
        }
        else if (Input.GetKey(toQuarry) && tileOnNewPosition.Equals(mountain) && !beingHandled)
        {
            tilemap.SetTile(tilemap.WorldToCell(newPosition), hill);
            StartCoroutine(HandleIt());
            transform.position = newPosition;
        }

        else
        {
            Debug.Log("You cannot walk on " + tileOnNewPosition + "!");
        }
    }