// Update is called once per frame void Update() { if (Input.touchCount > 0) { switch (Input.GetTouch(0).phase) { case TouchPhase.Ended: int tempScore = 0; List <GameObject> selected = new List <GameObject>(); foreach (GameObject go in toys) { //Debug.Log(go); Toy t = go.GetComponent <Toy>(); if (t.selected) { selected.Add(go); } } foreach (GameObject go in selected) { Toy t = go.GetComponent <Toy>(); t.Deselected(); if (selected.Count > 2) { //if (selected.Count > 2) { Count++; tempScore += t.score; ObjectPool.Kill(go); Inventory.Instance.Remove(go.GetComponent <Toy>().data); } } if (Count >= MaxCount) { UI.ResetTime(); GenerateOrder(); } UI.UpdateCount(); Inventory.Instance.Money += tempScore; UIManager.Instance.UpdateMoney(); break; } } }