//this coroutine creates a delay IEnumerator ExecuteAfterTime(float time) { yield return(new WaitForSeconds(time)); //congrats screen loads after player scored 10 points load.loadCongrats(); }
// Update is called once per frame private void Update() { if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) { RaycastHit2D hit = Physics2D.Raycast(mainCamera.ScreenToWorldPoint(Input.GetTouch(0).position), Vector2.zero); //if statement uses raycasting to check if player touched to object if (hit.collider != null) { startText.SetActive(false); //makes start text go away when game starts spriteRenderer.sprite = bubbleSprite; //sets sprite to bubble //changing position and size w/ newCombination method newCombination(dist.Pop(), sizes.Pop()); counter++; score++; scoreText.text = "score: " + score.ToString(); targetHit = "hit"; } //moves to next scene if (sizes.Count == 0 || dist.Count == 0) { load.loadCongrats(); writeOut.Add("Seconds between Touch, Levels, Bubble Size, Distance, Bubble Postion X, Bubble Position Y, Touch Position X, Touch Position Y, B Unit X, B Unit Y, T Unit X, T Unit Y, Hit/Missed"); writeOut.Add("Completion time: " + Time.timeSinceLevelLoad.ToString()); writeOut.Add("Date: " + DateTime.Now); MakeLogger(); Debug.Log("log created"); } //if circle is missed if (hit.collider == null) { dist.Push(dist.Peek()); sizes.Push(sizes.Peek()); targetHit = "missed"; } //continues to add game data while items are still in the stacks if (score > 1) //(sizes.Count != 0 && dist.Count != 0) { AddLog(); } } }