コード例 #1
0
    private void CreateStreet(Vector2Int coords, DirectionalTileType type)
    {
        var       streetBlockInfo = this.TilesetPrefabs.Get(type);
        Transform streetBlock     = GameObject.Instantiate <Transform>(streetBlockInfo.Item, StreetsParent);

        streetBlock.rotation = Quaternion.Euler(0f, streetBlockInfo.Rotation, 0f);
        streetBlock.position = new Vector3(coords.x * 69.8f, 0, coords.y * 69.8f);
        streetBlock.name     = coords.ToString() + type.ToString();
    }
コード例 #2
0
    private void SetImage(Vector2Int coords, DirectionalTileType type)
    {
        var t = CityStreetPanel.Find(coords.ToString());

        if (t != null)
        {
            GameObject.Destroy(t);
        }
        var           tile = this.TilesetIcons.Get(type);
        RectTransform r    = GameObject.Instantiate <RectTransform>(tile.Item, CityStreetPanel);

        if (Math.Abs(tile.Rotation) == 90)
        {
            tile.Rotation = -tile.Rotation;
        }
        r.rotation         = Quaternion.Euler(0, 0, tile.Rotation);
        r.anchoredPosition = new Vector3(coords.x * 100, coords.y * 100);
        r.name             = coords.ToString() + type.ToString();
    }