public override void Process(CyclopsActivateHorn hornPacket) { GameObject cyclops = NitroxIdentifier.RequireObjectFrom(hornPacket.Id); CyclopsHornControl horn = cyclops.RequireComponentInChildren <CyclopsHornControl>(); Utils.PlayEnvSound(horn.hornSound, horn.hornSound.gameObject.transform.position, 20f); }
public override void Process(CyclopsActivateHorn hornPacket) { GameObject cyclops = NitroxIdentifier.RequireObjectFrom(hornPacket.Id); CyclopsHornControl horn = cyclops.RequireComponentInChildren <CyclopsHornControl>(); EventInstance eventInstance = (EventInstance)fieldInfo.GetValue(horn.hornSound); eventInstance.setProperty(EVENT_PROPERTY.MAXIMUM_DISTANCE, 150f); fieldInfo.SetValue(horn.hornSound, eventInstance); horn.OnHandClick(null); }
public override void Process(CyclopsActivateHorn hornPacket) { Optional <GameObject> opCyclops = GuidHelper.GetObjectFrom(hornPacket.Guid); if (opCyclops.IsPresent()) { CyclopsHornControl horn = opCyclops.Get().GetComponentInChildren <CyclopsHornControl>(); if (horn != null) { Utils.PlayEnvSound(horn.hornSound, horn.hornSound.gameObject.transform.position, 20f); } else { Console.WriteLine("Could not activate the horn because CyclopsHornControl was not found on the cyclops " + hornPacket.Guid); } } else { Console.WriteLine("Could not find cyclops with guid " + hornPacket.Guid + " to activate horn."); } }