public override void StaticObjectUpdate() { if (audioPlayer != null) { float scale = InstanceUtil.GetStaticInstanceForGameObject(gameObject).ModelScale; audioPlayer.minDistance = minDistance * scale; audioPlayer.maxDistance = maxDistance * scale; } }
internal override void OnPostSetup() { if (customSpaceCenter == null) { StaticInstance staticInstance = InstanceUtil.GetStaticInstanceForGameObject(this.gameObject); customSpaceCenter = new CustomSpaceCenter(); customSpaceCenter.isFromFacility = true; customSpaceCenter.SpaceCenterName = FacilityName; customSpaceCenter.staticInstance = staticInstance; customSpaceCenter.gameObject = staticInstance.gameObject; SpaceCenterManager.AddSpaceCenter(customSpaceCenter); Log.Normal("SpaceCenter created: " + FacilityName); } }
public void Start() { AudioClip soundFile = GameDatabase.Instance.GetAudioClip(audioClip); if (soundFile == null) { Log.UserError("No audiofile found at: " + audioClip); return; } float scale = InstanceUtil.GetStaticInstanceForGameObject(gameObject).ModelScale; audioPlayer = gameObject.AddComponent <AudioSource>(); audioPlayer.clip = soundFile; audioPlayer.minDistance = minDistance * scale; audioPlayer.maxDistance = maxDistance * scale; audioPlayer.loop = loop; audioPlayer.volume = volume * KerbalKonstructs.soundMasterVolume; audioPlayer.playOnAwake = true; audioPlayer.spatialBlend = 1f; audioPlayer.rolloffMode = AudioRolloffMode.Linear; audioPlayer.Play(); }