protected override void ClientOnStart() { if (this.TargetWorldObject == null) { return; } var objectSoundPreset = this.SharedGetObjectSoundPreset(); if (objectSoundPreset == null) { return; } objectSoundPreset.PlaySound(ObjectSound.InteractStart, this.Character); var soundProcess = objectSoundPreset.GetSound(ObjectSound.InteractProcess); if (soundProcess != null) { this.soundEmitter = Api.Client.Audio.CreateSoundEmitter( this.Character, soundProcess, isLooped: true); } }
private void RebuildSoundEmitter() { var pilot = this.vehiclePublicState.PilotCharacter; if (pilot is null) { // sound emitter would be automatically destroyed as there is no pilot return; } this.DestroySoundEmitter(); // ensure sound emitter is destroyed as we're creating a new emitter this.lastVehiclePosition = this.vehicle.Position; var protoVehicle = (IProtoVehicle)this.vehicle.ProtoGameObject; this.soundEmitter = Client.Audio.CreateSoundEmitter( this.SceneObject, this.soundResourceEngine, is3D: !pilot.IsCurrentClientCharacter, isLooped: true, radius: protoVehicle.ObjectSoundRadius, volume: 0, isPlaying: false); this.Update(0); }
protected override void OnEnable() { base.OnEnable(); this.soundEmitter = Client.Audio.CreateSoundEmitter(this.SceneObject, SoundResource.NoSound, is3D: false, isLooped: false, volume: 0, isPlaying: false); }
public void Setup(IComponentSkeleton skeleton, ICharacter characterPilot) { this.skeleton = skeleton; this.characterPublicState = characterPilot.GetPublicState <ICharacterPublicState>(); this.soundEmitter = Api.Client.Audio.CreateSoundEmitter(this.SceneObject, SoundResource, is3D: !characterPilot.IsCurrentClientCharacter, isLooped: true, isPlaying: true, volume: 0); this.lastAngleRad = this.GetCurrentAngleRad(); }
public void Setup( IStaticWorldObject worldObject, double safeDistance, BaseClientComponentLightSource lightSource, IComponentSoundEmitter soundEmitter, double fromPercents, double toPercents, double durationSeconds) { if (fromPercents < 0) { throw new ArgumentException("fromPercent must be >= 0"); } if (fromPercents >= toPercents) { throw new ArgumentException("toPercent must be higher than fromPercent"); } if (durationSeconds <= 0) { throw new Exception("Duration must be > 0"); } this.worldObject = worldObject; this.safeDistance = safeDistance; this.durationSeconds = durationSeconds; this.lightSource = lightSource; this.soundEmitter = soundEmitter; var size = lightSource.RenderingSize; this.sizeRangeX = new Interval <double>( size.X * (fromPercents / 100.0), size.X * (toPercents / 100.0)); this.sizeRangeY = new Interval <double>( size.Y * (fromPercents / 100.0), size.Y * (toPercents / 100.0)); this.value = (this.lightSource.RenderingSize.X - this.sizeRangeX.Min) / (this.sizeRangeX.Max - this.sizeRangeX.Min); this.isIncreasingValue = true; this.Apply(deltaTime: 0); }
protected virtual void ClientSetupSoundEmitter(IComponentSoundEmitter soundEmitter) { }
protected override void OnDisable() { this.soundEmitter.Destroy(); this.soundEmitter = null; }
protected void DestroyProcessSoundEmitter() { this.soundEmitter?.Destroy(); this.soundEmitter = null; }
private void DestroySoundEmitter() { this.soundEmitter?.Destroy(); this.soundEmitter = null; }