示例#1
0
    public void PlaceTile(GameTile tile, Vector2Int pos, Quaternion rotation)
    {
        //Check if it already exists
        if (placedTiles.Contains(pos))
        {
            return;
        }
        if (tilemap.HasTile((Vector3Int)pos))
        {
            return;
        }
        if (GetTilesLeft() <= 0)
        {
            return;
        }

        //Add
        tilemap.SetTile((Vector3Int)pos, tile);
        placedTiles.Add(pos);

        //Rotate
        var instance = tilemap.GetInstantiatedObject((Vector3Int)pos);

        instance.transform.rotation = rotation;
    }
示例#2
0
    static int GetInstantiatedObject(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            UnityEngine.Tilemaps.Tilemap obj  = (UnityEngine.Tilemaps.Tilemap)ToLua.CheckObject(L, 1, typeof(UnityEngine.Tilemaps.Tilemap));
            UnityEngine.Vector3Int       arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 2);

            UnityEngine.GameObject o = obj.GetInstantiatedObject(arg0);
            ToLua.PushSealed(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }