Example #1
0
    private void NativeToolkit_OnImagePicked(Texture2D img, string path)
    {
        imagePath = path;
        //console.text += "\nImage picked at: " + imagePath;

        ST_PuzzleDisplayHyper puzzle = FindObjectOfType <ST_PuzzleDisplayHyper>();

        puzzle.SetImage(img);
        puzzle.ResetGame();

        Destroy(img);
    }
Example #2
0
    public void ResetGame(int newImageIndex)
    {
        gameStarted = false;
        StopCoroutine(CheckForComplete());

        audioSource.clip = BackgroundSounds[Random.Range(0, BackgroundSounds.Length - 1)];
        audioSource.Play();

        clearTiles();

        ST_PuzzleDisplayHyper puzzle = FindObjectOfType <ST_PuzzleDisplayHyper>();

        Width = int.Parse(WidthDisplay.GetComponent <UILabel>().text);

        Height = int.Parse(HeightDisplay.GetComponent <UILabel>().text);

        puzzle.Width  = Width;
        puzzle.Height = Height;

        SaveSystem.SetInt("Width", Width);
        SaveSystem.SetInt("Height", Height);

        // create the games puzzle tiles from the provided image.
        if (newImageIndex > -1)
        {
            CreatePuzzleTiles(newImageIndex);
        }
        else
        {
            CreatePuzzleTiles();
        }

        //randomize the tiles
        StartCoroutine(randomize());

        // mix up the puzzle.
        //StartCoroutine(JugglePuzzle());
    }