public void DoWithSearch(Entity entity, ObjectMesh objectMesh) { List <Plant> plants = objectMesh.GetTypedObjectsInRange <Plant>(entity, entity.Size); foreach (Plant plant in plants) { if (entity.GetRectangle().IntersectsWith(plant.GetRectangle())) // Entity needs to be touching the tree. { plant.Harvest(); } } IsActive = false; }
public void DoWithSearch(Entity entity, ObjectMesh objectMesh) { if (entity is Person person) { List <Item> pickups = objectMesh.GetTypedObjectsInRange <Item>(entity, entitySize); foreach (Item p in pickups) { if (person.GetRectangleF().IntersectsWith(p.GetRectangleF())) { person.Pickup(p); } } } End(); }
public void DoWithSearch(Entity entity, ObjectMesh objectMesh) { if (entity is Person person) { List <Item> pickups = objectMesh.GetTypedObjectsInRange <Item>(entity, entitySize); foreach (Item p in pickups) { if (person.GetRectangleF().IntersectsWith(p.GetRectangleF())) { person.Pickup(p); } } // If the person is inside the house, request the house's selected item. if (person.GetRectangleF().IntersectsWith(house.GetRectangleF()) && housePickup != null) { person.RequestItemByType(housePickup.Type); } } End(); }