コード例 #1
0
 public override void StaticObjectUpdate()
 {
     if (audioPlayer != null)
     {
         float scale = InstanceUtil.GetStaticInstanceForGameObject(gameObject).ModelScale;
         audioPlayer.minDistance = minDistance * scale;
         audioPlayer.maxDistance = maxDistance * scale;
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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();
        }