public override void Process(CyclopsToggleInternalLighting lightingPacket) { GameObject cyclops = GuidHelper.RequireObjectFrom(lightingPacket.Guid); CyclopsLightingPanel lighting = cyclops.RequireComponentInChildren <CyclopsLightingPanel>(); if (lighting.lightingOn != lightingPacket.IsOn) { using (packetSender.Suppress <CyclopsToggleInternalLighting>()) { lighting.ToggleInternalLighting(); } } }
public override void Process(CyclopsToggleInternalLighting lightingPacket) { Optional <GameObject> opCyclops = GuidHelper.GetObjectFrom(lightingPacket.Guid); if (opCyclops.IsPresent()) { CyclopsLightingPanel lighting = opCyclops.Get().GetComponentInChildren <CyclopsLightingPanel>(); if (lighting.lightingOn != lightingPacket.IsOn) { using (packetSender.Suppress <CyclopsToggleInternalLighting>()) { lighting.ToggleInternalLighting(); } } } else { Console.WriteLine("Could not find cyclops with guid " + lightingPacket.Guid + " to change internal lighting"); } }