public override void DoEvent(Animation animation) { /* Collision Test */ if (!World.InBound(light.GridLocation.X, light.GridLocation.Y)) { animation.StopAnimation(); World.RemoveLight(light); return; } HashSet<Entity> entities = World.GetEntities(light.GridLocation.X, light.GridLocation.Y); foreach (Entity entity in entities) { if (entity.Hidden) { continue; } if (entity is Person) { Person thisPerson = (Person)entity; if ((light.Type == Light.LightType.Yellow) && (thisPerson.Profession == Person.ProfessionType.Worker) && !thisPerson.IsEducated) { thisPerson.Educate(1); } if (light.Type == Light.LightType.White) { animation.AddEventFrame(new Reflection(new Point(light.GridLocation.X, light.GridLocation.Y), thisPerson.ReflectedLightColor, thisPerson.Direction, lastFrameTime), lastFrameTime); } else { animation.AddEventFrame(new Stop(light), lastFrameTime); } } else if (entity is Building) { Building building = (Building)entity; building.Illuminate(light.Type); animation.StopAnimation(); World.RemoveLight(light); } else if (entity is Mirror) { Mirror mirror = (Mirror)entity; Entity.DirectionType newDirection = mirror.Reflect(light.Direction); if (newDirection == Entity.DirectionType.NONE) { animation.StopAnimation(); World.RemoveLight(light); } else { light.Direction = newDirection; } } } Play(); }