Example #1
0
        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;
        }
Example #2
0
        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();
        }
Example #3
0
        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();
        }