本文整理汇总了C#中Sandbox.Game.Entities.MyEntity3DSoundEmitter类的典型用法代码示例。如果您正苦于以下问题:C# MyEntity3DSoundEmitter类的具体用法?C# MyEntity3DSoundEmitter怎么用?C# MyEntity3DSoundEmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyEntity3DSoundEmitter类属于Sandbox.Game.Entities命名空间,在下文中一共展示了MyEntity3DSoundEmitter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: UpdateBeforeSimulation
public override void UpdateBeforeSimulation()
{
base.UpdateBeforeSimulation();
//Sound control
if (MySandboxGame.IsDedicated == false)
{
if (m_fallSoundShouldPlay.Value == true)
{
if (m_soundEmitter == null)
{
m_soundEmitter = new MyEntity3DSoundEmitter(this);
//NeedsUpdate |= MyEntityUpdateEnum.EACH_100TH_FRAME;
}
if (m_soundEmitter.IsPlaying == false && m_fallSound != null && m_fallSound != MySoundPair.Empty)
m_soundEmitter.PlaySound(m_fallSound, true, true);
}
else
{
if (m_soundEmitter != null && m_soundEmitter.IsPlaying)
m_soundEmitter.StopSound(false);
}
}
//contact was made
if (m_obstacleContact && m_groundContact == false)
{
if (Physics.LinearVelocity.Y > 0f || Physics.LinearVelocity.LengthSquared() < 9f)
{
m_groundContact = true;
m_fallSoundShouldPlay.Value = false;//start crash sound
m_soundStart = DateTime.UtcNow;
}
else
{
m_obstacleContact = false;//scratching
}
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:39,代码来源:MyFracturedPiece.cs
示例17: StartShootSound
internal void StartShootSound(MyEntity3DSoundEmitter soundEmitter)
{
if (ShootSound != null)
{
if (soundEmitter.IsPlaying && !soundEmitter.Loop)
soundEmitter.StopSound(true);
soundEmitter.PlaySound(ShootSound, true);
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyGunBase.cs
示例18: InitSounds
private void InitSounds()
{
if (m_character.Definition.JumpSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.JUMP_SOUND] = new MySoundPair(m_character.Definition.JumpSoundName);
if (m_character.Definition.JetpackIdleSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.JETPACK_IDLE_SOUND] = new MySoundPair(m_character.Definition.JetpackIdleSoundName);
if (m_character.Definition.JetpackRunSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.JETPACK_RUN_SOUND] = new MySoundPair(m_character.Definition.JetpackRunSoundName);
if (m_character.Definition.CrouchDownSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.CROUCH_DOWN_SOUND] = new MySoundPair(m_character.Definition.CrouchDownSoundName);
if (m_character.Definition.CrouchUpSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.CROUCH_UP_SOUND] = new MySoundPair(m_character.Definition.CrouchUpSoundName);
if (m_character.Definition.PainSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.PAIN_SOUND] = new MySoundPair(m_character.Definition.PainSoundName);
if (m_character.Definition.SuffocateSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.SUFFOCATE_SOUND] = new MySoundPair(m_character.Definition.SuffocateSoundName);
if (m_character.Definition.DeathSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.DEATH_SOUND] = new MySoundPair(m_character.Definition.DeathSoundName);
if (m_character.Definition.DeathBySuffocationSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.DEATH_SOUND_SUFFOCATE] = new MySoundPair(m_character.Definition.DeathBySuffocationSoundName);
if (m_character.Definition.IronsightActSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.IRONSIGHT_ACT_SOUND] = new MySoundPair(m_character.Definition.IronsightActSoundName);
if (m_character.Definition.IronsightDeactSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.IRONSIGHT_DEACT_SOUND] = new MySoundPair(m_character.Definition.IronsightDeactSoundName);
if (m_character.Definition.FastFlySoundName != null)
{
m_windEmitter = new MyEntity3DSoundEmitter(Entity as MyEntity);
m_windEmitter.Force3D = false;
m_windSystem = true;
CharacterSounds[(int)CharacterSoundsEnum.FAST_FLY_SOUND] = new MySoundPair(m_character.Definition.FastFlySoundName);
}
//helmet sounds
if (m_character.Definition.HelmetOxygenNormalSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.HELMET_NORMAL] = new MySoundPair(m_character.Definition.HelmetOxygenNormalSoundName);
if (m_character.Definition.HelmetOxygenLowSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.HELMET_LOW] = new MySoundPair(m_character.Definition.HelmetOxygenLowSoundName);
if (m_character.Definition.HelmetOxygenCriticalSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.HELMET_CRITICAL] = new MySoundPair(m_character.Definition.HelmetOxygenCriticalSoundName);
if (m_character.Definition.HelmetOxygenNoneSoundName != null) CharacterSounds[(int)CharacterSoundsEnum.HELMET_NONE] = new MySoundPair(m_character.Definition.HelmetOxygenNoneSoundName);
if (m_character.Definition.MovementSoundName != null)
{
CharacterSounds[(int)CharacterSoundsEnum.MOVEMENT_SOUND] = new MySoundPair(m_character.Definition.MovementSoundName);
m_movementEmitter = new MyEntity3DSoundEmitter(Entity as MyEntity);
}
//Preload();
//if (m_character.Definition.DeathSoundName != null && m_character.Definition.DeathSoundName.Length > 0) CharacterSounds[(int)CharacterSoundsEnum.DEATH_SOUND] = new MySoundPair(m_character.Definition.DeathSoundName);
}
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:41,代码来源:MyCharacterSoundComponent.cs
示例19: IKFeetStepSounds
private void IKFeetStepSounds(MyEntity3DSoundEmitter walkEmitter, MySoundPair cueEnum)
{
var movementState = m_character.GetCurrentMovementState();
if (movementState.GetMode() == MyCharacterMovement.Flying)
return;
if (movementState.GetSpeed() != m_lastUpdateMovementState.GetSpeed())
{
walkEmitter.StopSound(true);
m_lastStepTime = 0;
}
int usedMinimumDelay = int.MaxValue;
if (movementState.GetDirection() != MyCharacterMovement.NoDirection)
{
switch (movementState.GetSpeed())
{
case MyCharacterMovement.NormalSpeed:
usedMinimumDelay = m_stepMinimumDelayWalk;
break;
case MyCharacterMovement.Fast:
usedMinimumDelay = m_stepMinimumDelayRun;
break;
case MyCharacterMovement.VeryFast:
usedMinimumDelay = m_stepMinimumDelaySprint;
break;
}
}
bool minimumDelayExceeded = false;
minimumDelayExceeded = (MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastStepTime) >= usedMinimumDelay;
//MyRenderProxy.DebugDrawAABB(m_character.PositionComp.WorldAABB, Color.White);
if (minimumDelayExceeded)
{
int leftAnkleBoneIndex, rightAnkleBoneIndex;
MyCharacterBone leftAnkleBone = m_character.AnimationController != null
? m_character.AnimationController.FindBone(m_character.Definition.LeftAnkleBoneName, out leftAnkleBoneIndex)
: null;
MyCharacterBone rightAnkleBone = m_character.AnimationController != null
? m_character.AnimationController.FindBone(m_character.Definition.RightAnkleBoneName, out rightAnkleBoneIndex)
: null;
Vector3 posLeftFoot = leftAnkleBone != null
? leftAnkleBone.AbsoluteTransform.Translation
: m_character.PositionComp.LocalAABB.Center;
Vector3 posRightFoot = rightAnkleBone != null
? rightAnkleBone.AbsoluteTransform.Translation
: m_character.PositionComp.LocalAABB.Center;
float ankleHeight;
MyFeetIKSettings settingsIK;
if (m_character.Definition.FeetIKSettings != null
&& m_character.Definition.FeetIKSettings.TryGetValue(MyCharacterMovementEnum.Standing, out settingsIK))
{
ankleHeight = settingsIK.FootSize.Y;
}
else
{
ankleHeight = DEFAULT_ANKLE_HEIGHT;
}
float charSpeed = 0f;
if (m_character.AnimationController != null)
m_character.AnimationController.Variables.GetValue(MyAnimationVariableStorageHints.StrIdSpeed, out charSpeed);
if (posLeftFoot.Y - ankleHeight < m_character.PositionComp.LocalAABB.Min.Y
|| posRightFoot.Y - ankleHeight < m_character.PositionComp.LocalAABB.Min.Y)
{
if(charSpeed > 0.05f)
walkEmitter.PlaySound(cueEnum);
m_lastStepTime = MySandboxGame.TotalGamePlayTimeInMilliseconds;
}
}
m_lastUpdateMovementState = movementState;
}
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:74,代码来源:MyCharacterSoundComponent.cs
示例20: InitComponent
public bool InitComponent(MyCubeGrid shipGrid)
{
if (shipGrid.GridSizeEnum == MyCubeSize.Small && MyFakes.ENABLE_NEW_SMALL_SHIP_SOUNDS == false)
return false;
if (shipGrid.GridSizeEnum == MyCubeSize.Large && MyFakes.ENABLE_NEW_LARGE_SHIP_SOUNDS == false)
return false;
m_shipGrid = shipGrid;
m_shipThrusters = m_shipGrid.Components.Get<MyEntityThrustComponent>();
m_shipWheels = m_shipGrid.GridSystems.WheelSystem;
m_thrusterVolumes = new float[(Enum.GetNames(typeof(ShipThrusters)).Length)];
m_thrusterVolumeTargets = new float[(Enum.GetNames(typeof(ShipThrusters)).Length)];
for (int i = 1; i < m_thrusterVolumes.Length; i++)
{
m_thrusterVolumes[i] = 0f;
m_thrusterVolumeTargets[i] = 0f;
}
m_thrusterVolumes[0] = 1f;
m_thrusterVolumeTargets[0] = 1f;
for (int i = 0; i < m_emitters.Length; i++)
{
m_emitters[i] = new MyEntity3DSoundEmitter(m_shipGrid);
m_emitters[i].Force2D = m_shouldPlay2D;
m_emitters[i].Force3D = !m_shouldPlay2D;
}
m_initialized = true;
return true;
}
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:31,代码来源:MyShipSoundComponent.cs
注:本文中的Sandbox.Game.Entities.MyEntity3DSoundEmitter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论