// Called when object touches trigger collider. void OnTriggerStay2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { //Debug.Log(name + " detects Chomper!"); if (Input.GetKeyDown(KeyCode.Space)) { //Debug.Log("Chomper picked up " + name + " worth " + value); if (player.NumberOfFlowers == 0) { player.FlowerType = value; } if (value == player.FlowerType) { player.AddToBasket(value); player.DisplayBasket(); game.UpdateBasketText(); this.gameObject.SetActive(false); textValue.color = Color.white; } else { game.SetDialogue("Chomper: I can only pick up flowers of the same type!"); Debug.Log("Chomper can only pick up flowers of the same type!"); } } } }