protected override void ClientSetupRendering(ClientInitializeData data) { var vehicle = data.GameObject; var publicState = data.PublicState; // setup light source for the active hoverboard engine var lightSourceActiveEngine = this.ClientCreateActiveEngineLightSource(vehicle); RefreshLightSource(); data.PublicState.ClientSubscribe(_ => _.PilotCharacter, RefreshLightSource, data.ClientState); void RefreshLightSource() { lightSourceActiveEngine.IsEnabled = !(publicState.PilotCharacter is null); } var componentHoverboardVisualManager = vehicle.ClientSceneObject .AddComponent <ComponentHoverboardVisualManager>(); componentHoverboardVisualManager .Setup(vehicle, lightSourceActiveEngine, textureResourceHoverboard: this.TextureResourceHoverboard, textureResourceLight: this.TextureResourceHoverboardLight, this.StatMoveSpeed); var componentHoverboardSoundEmitter = HoverboardEngineSoundEmittersManager.CreateSoundEmitter( vehicle, this.EngineSoundResource, this.EngineSoundVolume); this.ClientSetupEngineAudio(vehicle, componentHoverboardSoundEmitter); }
protected override void OnDisable() { HoverboardEngineSoundEmittersManager.OnSoundEmitterComponentVehicleDestroyed(this); }