void Start() { // Debug.Log("***************************** CargoPuzzle.Start()"); // Init all the block data if (FindObjectOfType <CargoMCP>() == null) { PuzzleState = ePuzzleState.PLAYING; } else { PuzzleState = ePuzzleState.OFF; } IgnoreBlockInput = false; CurBlock = null; Blocks = this.GetComponentsInChildren <Block>(); //Debug.Log("num blocks: " + Blocks.Length); for (int i = 0; i < Blocks.Length; i++) { //Debug.Log("initting block: " + this.name); Blocks[i].Init(this); if (Blocks[i].tag.Equals("Player")) { Player = Blocks[i].GetComponent <Block>(); } if (Blocks[i].tag.Equals("Exit")) { Exit = Blocks[i].GetComponent <Block>(); } } SetInputState(eTouchState.NONE, InputTimer, TapCount); }
/// <summary> /// Temp function for going back to the Hub /// </summary> /// <returns></returns> IEnumerator ExitPuzzle() { PuzzleState = ePuzzleState.OFF; if (CargoMCP != null) { yield return(new WaitForSeconds(1f)); CargoMCP.PuzzleFinished(); } else { float time = 0f; while (time < 1.5f) { time += Time.deltaTime; yield return(new WaitForEndOfFrame()); } SceneManager.LoadScene(0); } }
public void BeginPlaying() { PuzzleState = ePuzzleState.PLAYING; }