Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        // Reset scene when reset key is pressed
        if (Input.GetKeyDown(ResetKey))
        {
            relativeLevel(0);
        }

        if (Input.GetKeyDown(HardResetKey))
        {
            relativeLevel(1);
        }



        // Advance level when landmark is reached, or all "landmark" is removed
        switch (obj)
        {
        case objective.FILL:
            UnityEngine.Tilemaps.TileBase[] tm_array = tm.GetTilesBlock(tm_bounds);
            int num_lm_tiles = System.Array.FindAll <UnityEngine.Tilemaps.TileBase>(tm_array, x => x == landmark).Length;

            if (landmark2 != null)
            {
                num_lm_tiles += System.Array.FindAll <UnityEngine.Tilemaps.TileBase>(tm_array, x => x == landmark2).Length;
            }

            if (num_lm_tiles < 2)
            {
                relativeLevel(1);
            }
            break;

        case objective.GOAL:
            if (tm.GetTile(Vector3Int.FloorToInt(player.transform.position)) == landmark)
            {
                relativeLevel(1);
            }
            break;

        case objective.EXIT:
            if (tm.GetTile(Vector3Int.FloorToInt(player.transform.position)) == landmark)
            {
                relativeLevel(0);
            }

            if (!tm_bounds.Contains(Vector3Int.FloorToInt(player.transform.position)))
            {
                relativeLevel(1);
            }

            break;

        default:
            break;
        }
    }
Exemple #2
0
    static int GetTilesBlock(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            UnityEngine.Tilemaps.Tilemap obj  = (UnityEngine.Tilemaps.Tilemap)ToLua.CheckObject(L, 1, typeof(UnityEngine.Tilemaps.Tilemap));
            UnityEngine.BoundsInt        arg0 = StackTraits <UnityEngine.BoundsInt> .Check(L, 2);

            UnityEngine.Tilemaps.TileBase[] o = obj.GetTilesBlock(arg0);
            ToLua.Push(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }