Esempio n. 1
0
    private void UpdateMap()
    {
        // Go through mazeStructure and place needed tile for each point
        for (int i = 0; i < mazeSize; i++)
        {
            for (int j = 0; j < mazeSize; j++)
            {
                // Marker- and playermap
                if (i == inputScript.GetPlayerX() && j == inputScript.GetPlayerZ())
                {
                    playerMarkerTilemap.SetTile(new Vector3Int(i, j, 0), player);

                    // Rotate the player arrow according to playerRotation
                    Matrix4x4 matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, playerRotation), Vector3.one);
                    playerMarkerTilemap.SetTransformMatrix(new Vector3Int(i, j, 0), matrix);
                    playerMarkerTilemap.RefreshTile(new Vector3Int(i, j, 0));
                }
                else if (i == inputScript.GetMarkerX() && j == inputScript.GetMarkerZ())
                {
                    playerMarkerTilemap.SetTile(new Vector3Int(i, j, 0), marker);
                }
                else
                {
                    playerMarkerTilemap.SetTile(new Vector3Int(i, j, 0), null);
                }

                // Floormap
                if (mazeStructure[i * 3 + 1, j * 3 + 1] == 1)
                {
                    floorTilemap.SetTile(new Vector3Int(i, j, 0), GetTile(i * 3 + 1, j * 3 + 1));
                }
            }
        }
    }
Esempio n. 2
0
    void FixedUpdate()
    {
        if (!GotInputScript())
        {
            return;
        }

        step = (step + 0.05f) % 360f;
        float x = inputScript.GetMarkerX() * 3f;
        float y = 0f;
        float z = inputScript.GetMarkerZ() * 3f;

        this.transform.position = new Vector3(x, y, z);
    }