void Start() { if (!SpawnPuzzle && puzzlename != "") { Puzzle = GameObject.Find(puzzlename).GetComponent <ST_PuzzleDisplay>(); } }
// Use this for initialization void Start() { ST_PuzzleDisplay.PuzzleMoves = 0; ST_PuzzleDisplay.CanMove = false; ST_PuzzleDisplay.CanCount = false; ST_PuzzleDisplay.Moves.Clear(); //Texture2D encryptImg = PuzzleImage as Texture2D; Instance = this; AudioSource = GetComponent <AudioSource>(); PuzzleImage = PuzzleImages[UnityEngine.Random.Range(0, PuzzleImages.Length)]; PuzzleImage = Steganography.Encode(PuzzleImage, PuzzleManager.CurrentHash); // create the games puzzle tiles from the provided image. CreatePuzzleTiles2(); // mix up the puzzle. //StartCoroutine(JugglePuzzle()); //SetInitialState(PuzzleManager.PuzzleData.field); StartCoroutine(CheckForComplete()); CanMove = true; CanCount = true; LetsgoPopup.EnableFor(1); GameTimerUpdater.StartTimer(); }
private void NativeToolkit_OnImagePicked(Texture2D img, string path) { imagePath = path; //console.text += "\nImage picked at: " + imagePath; ST_PuzzleDisplay puzzle = FindObjectOfType <ST_PuzzleDisplay>(); puzzle.SetImage(img); puzzle.ResetGame(); Destroy(img); }
public void ResetGame(int newImageIndex) { gameStarted = false; StopCoroutine(CheckForComplete()); audioSource.clip = BackgroundSounds[Random.Range(0, BackgroundSounds.Length - 1)]; audioSource.Play(); clearTiles(); ST_PuzzleDisplay puzzle = FindObjectOfType <ST_PuzzleDisplay>(); 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()); }