Esempio n. 1
0
 /// <inheritdoc/>
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     UpdateContextMenu();
     if (HighLogic.LoadedSceneIsFlight)
     {
         sndAttach = SpatialSounds.Create3dSound(gameObject, sndStorePath, maxDistance: 10);
     }
 }
Esempio n. 2
0
 /// <inheritdoc/>
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor || state == StartState.None)
     {
         return;
     }
     sndTimeStart = SpatialSounds.Create3dSound(gameObject, timeStartSndPath);
     sndTimeEnd   = SpatialSounds.Create3dSound(gameObject, timeEndSndPath);
     sndTimeLoop  = SpatialSounds.Create3dSound(gameObject, timeLoopSndPath, loop: true);
 }
Esempio n. 3
0
        /// <inheritdoc/>
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);

            if (resHandler.inputResources.Count == 0)
            {
                var moduleResource = new ModuleResource();
                moduleResource.name  = StockResourceNames.ElectricCharge;
                moduleResource.title = KSPUtil.PrintModuleName(StockResourceNames.ElectricCharge);
                moduleResource.id    = StockResourceNames.ElectricCharge.GetHashCode();
                moduleResource.rate  = (double)motorPowerDrain;
                resHandler.inputResources.Add(moduleResource);
            }

            sndMotor      = SpatialSounds.Create3dSound(part.gameObject, sndPathMotor, loop: true);
            sndMotorStart = SpatialSounds.Create3dSound(part.gameObject, sndPathMotorStart);
            sndMotorStop  = SpatialSounds.Create3dSound(part.gameObject, sndPathMotorStop);
        }
Esempio n. 4
0
 public void TogglePlayStateEvent()
 {
     if (sndMainTune == null)
     {
         sndMainTune = SpatialSounds.Create3dSound(
             gameObject, sndPath, loop: loop, maxDistance: sndMaxDistance);
     }
     if (sndMainTune.isPlaying)
     {
         sndMainTune.Stop();
     }
     else
     {
         sndMainTune.Play();
         if (!loop)
         {
             StartCoroutine(DetectEndOfClip());
         }
     }
     UpdateContextMenu();
 }
Esempio n. 5
0
        /// <inheritdoc/>
        protected override void InitModuleSettings()
        {
            base.InitModuleSettings();
            Destroy(sndMotor);
            sndMotor = SpatialSounds.Create3dSound(part.gameObject, sndPathMotor, loop: true);
            Destroy(sndMotorStart);
            sndMotorStart = SpatialSounds.Create3dSound(part.gameObject, sndPathMotorStart);
            Destroy(sndMotorStop);
            sndMotorStop = SpatialSounds.Create3dSound(part.gameObject, sndPathMotorStop);

            var moduleResource = resHandler.inputResources
                                 .FirstOrDefault(x => x.name == StockResourceNames.ElectricCharge);

            if (moduleResource == null)
            {
                moduleResource      = new ModuleResource();
                moduleResource.name = StockResourceNames.ElectricCharge;
                moduleResource.id   = StockResourceNames.ElectricCharge.GetHashCode();
                resHandler.inputResources.Add(moduleResource);
            }
            moduleResource.title = KSPUtil.PrintModuleName(StockResourceNames.ElectricCharge);
            moduleResource.rate  = (double)motorPowerDrain;
        }