public override void Process(CyclopsActivateShield shieldPacket) { Optional <GameObject> opCyclops = GuidHelper.GetObjectFrom(shieldPacket.Guid); if (opCyclops.IsPresent()) { CyclopsShieldButton shield = opCyclops.Get().GetComponentInChildren <CyclopsShieldButton>(); if (shield != null) { using (packetSender.Suppress <CyclopsActivateShield>()) { shield.OnClick(); } } else { Console.WriteLine("Could not activate shield because CyclopsShieldButton was not found on the cyclops " + shieldPacket.Guid); } } else { Console.WriteLine("Could not find cyclops with guid " + shieldPacket.Guid + " to activate shield."); } }
public override void Process(CyclopsActivateShield shieldPacket) { GameObject cyclops = GuidHelper.RequireObjectFrom(shieldPacket.Guid); CyclopsShieldButton shield = cyclops.RequireComponentInChildren <CyclopsShieldButton>(); using (packetSender.Suppress <CyclopsActivateShield>()) { shield.OnClick(); } }