void OnTriggerEnter2D(Collider2D coll) { if (!has_tomato && coll.gameObject.GetComponent <TomatoFruit>() != null) { TomatoFruit tomato = coll.gameObject.GetComponent <TomatoFruit>(); if (tomato.IsRipe()) { Destroy(tomato.gameObject); thieving_behaviour.LeaveArea(); has_tomato = true; } else { thieving_behaviour.LookForNewTarget(ThievingTarget.TomatoFruit); } } }
void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.GetComponent <TomatoSeed>() != null) { inventory.AddSeed(); Destroy(coll.gameObject); } else if (coll.gameObject.GetComponent <TomatoFruit>() != null) { TomatoFruit tomato = coll.gameObject.GetComponent <TomatoFruit>(); if (tomato.IsRipe()) { inventory.AddTomato(); Destroy(coll.gameObject); } } else if (coll.gameObject.GetComponent <ShopSpot>() != null) { ShopSpotCollide(coll.gameObject.GetComponent <ShopSpot>()); } }