当前位置: 首页>>代码示例>>C#>>正文


C# Entities.MyEntity3DSoundEmitter类代码示例

本文整理汇总了C#中Sandbox.Game.Entities.MyEntity3DSoundEmitter的典型用法代码示例。如果您正苦于以下问题:C# MyEntity3DSoundEmitter类的具体用法?C# MyEntity3DSoundEmitter怎么用?C# MyEntity3DSoundEmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyEntity3DSoundEmitter类属于Sandbox.Game.Entities命名空间,在下文中一共展示了MyEntity3DSoundEmitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MyFloatingObject

 public MyFloatingObject()
 {
     WasRemovedFromWorld = false;
     m_soundEmitter = new MyEntity3DSoundEmitter(this);
     m_lastTimePlayedSound = MySandboxGame.TotalGamePlayTimeInMilliseconds;
     Render = new Components.MyRenderComponentFloatingObject();
 }
开发者ID:martejj,项目名称:SpaceEngineers,代码行数:7,代码来源:MyFloatingObject.cs

示例2: MyGridJumpDriveSystem

        public MyGridJumpDriveSystem(MyCubeGrid grid)
        {
            m_grid = grid;

            SyncObject = new MySyncJumpDriveSystem(m_grid);
            m_soundEmitter = new MyEntity3DSoundEmitter(m_grid);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:7,代码来源:MyGridJumpDriveSystem.cs

示例3: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            InitializeSinkComponent();
            base.Init(objectBuilder, cubeGrid);
            if (CubeGrid.CreatePhysics)
            {
            	// Put on my fake, because it does performance issues
                if (MyFakes.ENABLE_GRAVITY_PHANTOM)
                {
                        var shape = CreateFieldShape();
                        Physics = new Sandbox.Engine.Physics.MyPhysicsBody(this, RigidBodyFlag.RBF_KINEMATIC);
                        Physics.IsPhantom = true;
                        Physics.CreateFromCollisionObject(shape, PositionComp.LocalVolume.Center, WorldMatrix, null, Sandbox.Engine.Physics.MyPhysics.CollisionLayers.GravityPhantomLayer);
                        shape.Base.RemoveReference();
                        Physics.Enabled = IsWorking;
                }
                NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;

                SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;
                ResourceSink.Update();
            }
            m_soundEmitter = new MyEntity3DSoundEmitter(this, true);
            m_baseIdleSound.Init("BlockGravityGen");
			
        }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:25,代码来源:MyGravityGeneratorBase.cs

示例4: emitter_StoppedPlaying

 static void emitter_StoppedPlaying(MyEntity3DSoundEmitter emitter)
 {
     emitter.Entity = null;
     emitter.SoundId = new MyCueId(MyStringHash.NullOrEmpty);
     m_singleUseEmitterPool.Enqueue(emitter);
     m_currentEmitters--;
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:7,代码来源:MyAudioComponent.cs

示例5: MySmallMissileLauncher

 public MySmallMissileLauncher()
 {
     m_gunBase = new MyGunBase();
     m_soundEmitter = new MyEntity3DSoundEmitter(this);
     m_useConveyorSystem.Value = true;
     SyncType.Append(m_gunBase);
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:7,代码来源:MySmallMissileLauncher.cs

示例6: MySolarPanel

	    public MySolarPanel()
	    {
            SourceComp = new MyResourceSourceComponent();

            m_soundEmitter = new MyEntity3DSoundEmitter(this, true);
            NeedsUpdate |= MyEntityUpdateEnum.EACH_100TH_FRAME;
	    }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:7,代码来源:MySolarPanel.cs

示例7: MySoundBlock

        private bool m_willStartSound; // will start sound in updateaftersimulation

        #endregion Fields

        #region Constructors

        public MySoundBlock()
            : base()
        {
            #if XB1 // XB1_SYNC_NOREFLECTION
            m_soundRadius = SyncType.CreateAndAddProp<float>();
            m_volume = SyncType.CreateAndAddProp<float>();
            m_cueId = SyncType.CreateAndAddProp<MyCueId>();
            m_loopPeriod = SyncType.CreateAndAddProp<float>();
            #endif // XB1
            CreateTerminalControls();

            m_soundPair = new MySoundPair();

            m_soundEmitterIndex = 0;
            m_soundEmitters = new MyEntity3DSoundEmitter[EMITTERS_NUMBER];
            for (int i = 0; i < EMITTERS_NUMBER; i++)
            {
                m_soundEmitters[i] = new MyEntity3DSoundEmitter(this);
                m_soundEmitters[i].Force3D = true;
            }

            m_volume.ValueChanged += (x) => VolumeChanged();
            m_soundRadius.ValueChanged += (x) => RadiusChanged();
            m_cueId.ValueChanged += (x) => SelectionChanged();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:31,代码来源:MySoundBlock.cs

示例8: MyFloatingObject

        public MyFloatingObject()
        {
            WasRemovedFromWorld = false;
            m_soundEmitter = new MyEntity3DSoundEmitter(this);
            m_lastTimePlayedSound = MySandboxGame.TotalGamePlayTimeInMilliseconds;
            Render = new Components.MyRenderComponentFloatingObject();

            SyncType = SyncHelpers.Compose(this);

            Amount.ValueChanged += (x) => { Item.Amount = Amount.Value; UpdateInternalState(); };
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:11,代码来源:MyFloatingObject.cs

示例9: TryGetSoundEmitter

 /// <summary>
 /// Use this only for 3d one-time nonloop sounds, emitter returns to pool after the sound is played
 /// Dont forget to set your entity
 /// </summary>
 /// <returns>Emitter or null if none is avaliable in pool</returns>
 public static MyEntity3DSoundEmitter TryGetSoundEmitter()
 {
     MyEntity3DSoundEmitter emitter = null;
     if(!m_singleUseEmitterPool.TryDequeue(out emitter))
         if (m_currentEmitters < POOL_CAPACITY)
         {
             emitter = new MyEntity3DSoundEmitter(null);
             emitter.StoppedPlaying += emitter_StoppedPlaying;
             m_currentEmitters++;
         }
     return emitter;
 }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:17,代码来源:MyAudioComponent.cs

示例10: MyMissile

 public MyMissile()
 {
     m_collidedEntity_OnClose = collidedEntity_OnClose;
     m_soundEmitter = new MyEntity3DSoundEmitter(this);
     if (MySession.Static.Settings.RealisticSound && MyFakes.ENABLE_NEW_SOUNDS)
     {
         Func<bool> expr = () =>
         MySession.ControlledEntity != null && MySession.ControlledEntity.Entity is MyCharacter && MySession.ControlledEntity.Entity == m_collidedEntity;
         m_soundEmitter.EmitterMethods[MyEntity3DSoundEmitter.MethodsEnum.ShouldPlay2D].Add(expr);
         m_soundEmitter.EmitterMethods[MyEntity3DSoundEmitter.MethodsEnum.CanHear].Add(expr);
     }
     (PositionComp as MyPositionComponent).WorldPositionChanged = WorldPositionChanged;
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:13,代码来源:MyMissile.cs

示例11: EffectSoundEmitter

 public EffectSoundEmitter(uint id, Vector3 position, MySoundPair sound)
 {
     ParticleSoundId = id;
     Updated = true;
     Emitter = new MyEntity3DSoundEmitter(null);
     Emitter.SetPosition(position);
     Emitter.PlaySound(sound);
     if (Emitter.Sound != null)
         OriginalVolume = Emitter.Sound.Volume;
     else
         OriginalVolume = 1f;
     Emitter.Update();
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:13,代码来源:MyParticleEffects.cs

示例12: emitter_StoppedPlaying

 static void emitter_StoppedPlaying(MyEntity3DSoundEmitter emitter)
 {
     if (emitter == null)
         return;
     emitter.Entity = null;
     emitter.SoundId = new MyCueId(MyStringHash.NullOrEmpty);
     if (m_borrowedEmittors.Count > 0)
     {
         int index = m_borrowedEmittors.IndexOf(emitter);
         if (index >= 0 && index < m_borrowedEmittors.Count)
             m_borrowedEmittors.RemoveAt(index);
     }
     m_singleUseEmitterPool.Enqueue(emitter);
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:14,代码来源:MyAudioComponent.cs

示例13: TryGetSoundEmitter

 /// <summary>
 /// Use this only for 3d one-time nonloop sounds, emitter returns to pool after the sound is played
 /// Dont forget to set your entity
 /// </summary>
 /// <returns>Emitter or null if none is avaliable in pool</returns>
 public static MyEntity3DSoundEmitter TryGetSoundEmitter()
 {
     MyEntity3DSoundEmitter emitter = null;
     if (!m_singleUseEmitterPool.TryDequeue(out emitter))
     {
         if (m_currentEmitters >= POOL_CAPACITY)
             CleanUpEmitters();
         if (m_currentEmitters < POOL_CAPACITY)
         {
             emitter = new MyEntity3DSoundEmitter(null);
             emitter.StoppedPlaying += emitter_StoppedPlaying;
             m_currentEmitters++;
         }
     }
     if (emitter != null)
         m_borrowedEmittors.Add(emitter);
     return emitter;
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:23,代码来源:MyAudioComponent.cs

示例14: EffectSoundEmitter

 public EffectSoundEmitter(uint id, Vector3 position, MySoundPair sound)
 {
     ParticleSoundId = id;
     Updated = true;
     MyEntity entity = null;
     if (MyFakes.ENABLE_NEW_SOUNDS && MySession.Static.Settings.RealisticSound)//snap emitter to closest block - used for realistic sounds
     {
         List<MyEntity> m_detectedObjects = new List<MyEntity>();
         BoundingSphereD effectSphere = new BoundingSphereD(MySession.Static.LocalCharacter != null ? MySession.Static.LocalCharacter.PositionComp.GetPosition() : MySector.MainCamera.Position, 2f);
         MyGamePruningStructure.GetAllEntitiesInSphere(ref effectSphere, m_detectedObjects);
         float distBest = float.MaxValue;
         float dist;
         for (int i = 0; i < m_detectedObjects.Count; i++)
         {
             MyCubeBlock block = m_detectedObjects[i] as MyCubeBlock;
             if (block != null)
             {
                 dist = Vector3.DistanceSquared(MySession.Static.LocalCharacter.PositionComp.GetPosition(), block.PositionComp.GetPosition());
                 if (dist < distBest)
                 {
                     dist = distBest;
                     entity = block;
                 }
             }
         }
         m_detectedObjects.Clear();
     }
     Emitter = new MyEntity3DSoundEmitter(entity);
     Emitter.SetPosition(position);
     if (sound == null)
         sound = MySoundPair.Empty;
     Emitter.PlaySound(sound);
     if (Emitter.Sound != null)
         OriginalVolume = Emitter.Sound.Volume;
     else
         OriginalVolume = 1f;
     Emitter.Update();
     SoundPair = sound;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:39,代码来源:MyParticleEffects.cs

示例15: UpdateProductionSound

        private void UpdateProductionSound()
        {
            if (m_soundEmitter == null)
            {
                m_soundEmitter = new MyEntity3DSoundEmitter(Entity as MyEntity);
            }

            if (this.m_currentItemStatus < 1f)
            {
                var blueprint = this.GetCurrentItemInProduction();
                if (blueprint != null && blueprint.Blueprint.ProgressBarSoundCue != null)
                {
                    m_soundEmitter.PlaySingleSound(MySoundPair.GetCueId(blueprint.Blueprint.ProgressBarSoundCue));
                }
                else
                {
                    m_soundEmitter.PlaySingleSound(ActionSound);
                }
            }
            else
            {
                m_soundEmitter.StopSound(true);
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:24,代码来源:MyCraftingComponentBasic.cs


注:本文中的Sandbox.Game.Entities.MyEntity3DSoundEmitter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。