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"); }
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(); }
public MyFloatingObject() { WasRemovedFromWorld = false; m_soundEmitter = new MyEntity3DSoundEmitter(this); m_lastTimePlayedSound = MySandboxGame.TotalGamePlayTimeInMilliseconds; Render = new Components.MyRenderComponentFloatingObject(); }
static void emitter_StoppedPlaying(MyEntity3DSoundEmitter emitter) { emitter.Entity = null; emitter.SoundId = new MyCueId(MyStringHash.NullOrEmpty); m_singleUseEmitterPool.Enqueue(emitter); m_currentEmitters--; }
public MySolarPanel() { SourceComp = new MyResourceSourceComponent(); m_soundEmitter = new MyEntity3DSoundEmitter(this, true); NeedsUpdate |= MyEntityUpdateEnum.EACH_100TH_FRAME; }
public MySmallMissileLauncher() { m_gunBase = new MyGunBase(); m_soundEmitter = new MyEntity3DSoundEmitter(this); m_useConveyorSystem.Value = true; SyncType.Append(m_gunBase); }
public MyGridJumpDriveSystem(MyCubeGrid grid) { m_grid = grid; SyncObject = new MySyncJumpDriveSystem(m_grid); m_soundEmitter = new MyEntity3DSoundEmitter(m_grid); }
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(); }; }
/// <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; }
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; }
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(); }
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); }
public MyFloatingObject() { WasRemovedFromWorld = false; m_soundEmitter = new MyEntity3DSoundEmitter(this); m_lastTimePlayedSound = MySandboxGame.TotalGamePlayTimeInMilliseconds; Render = new Components.MyRenderComponentFloatingObject(); #if !XB1 // !XB1_SYNC_NOREFLECTION SyncType = SyncHelpers.Compose(this); #else // XB1 SyncType = new SyncType(new List <SyncBase>()); Amount = SyncType.CreateAndAddProp <MyFixedPoint>(); #endif // XB1 Amount.ValueChanged += (x) => { Item.Amount = Amount.Value; UpdateInternalState(); }; }
/// <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; }
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 } } }
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; }
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 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); m_baseIdleSound.Init("BlockGravityGen"); }
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); } }
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); }
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; }
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; }
public MyCharacterSoundComponent() { m_soundEmitters = new List<MyEntity3DSoundEmitter>(Enum.GetNames(typeof(MySoundEmitterEnum)).Length); foreach(var name in Enum.GetNames(typeof(MySoundEmitterEnum))) { m_soundEmitters.Add(new MyEntity3DSoundEmitter(Entity as MyEntity)); } for (int i = 0; i < Enum.GetNames(typeof(CharacterSoundsEnum)).Length; i++) { CharacterSounds.Add(i, EmptySoundPair); } if (MySession.Static != null && (MySession.Static.Settings.EnableOxygen || MySession.Static.CreativeMode)) m_oxygenEmitter = new MyEntity3DSoundEmitter(Entity as MyEntity); }
/// <param name="drillEntity">Entity to which this drill is attached.</param> /// <param name="inventoryCollectionRatio">Ratio (0 to 1) of mined material that will be stored in inventory (if one is assigned), rest will be thrown out in space.</param> public MyDrillBase( MyEntity drillEntity, MyParticleEffectsIDEnum dustEffectId, MyParticleEffectsIDEnum dustEffectStonesId, MyParticleEffectsIDEnum sparksEffectId, MyDrillSensorBase sensor, MyDrillCutOut cutOut, float animationSlowdownTimeInSeconds, float floatingObjectSpawnOffset, float floatingObjectSpawnRadius, Sounds sounds, float inventoryCollectionRatio = 0f) { m_drillEntity = drillEntity; m_sensor = sensor; m_cutOut = cutOut; m_dustEffectId = dustEffectId; m_dustEffectStonesId = dustEffectStonesId; m_sparksEffectId = sparksEffectId; m_animationSlowdownTimeInSeconds = animationSlowdownTimeInSeconds; m_floatingObjectSpawnOffset = floatingObjectSpawnOffset; m_floatingObjectSpawnRadius = floatingObjectSpawnRadius; Debug.Assert(inventoryCollectionRatio >= 0f && inventoryCollectionRatio <= 1f, "Inventory collection ratio must be in range <0;1>"); m_inventoryCollectionRatio = (MyFixedPoint)inventoryCollectionRatio; m_drilledMaterialBuffer = new Dictionary<MyVoxelMaterialDefinition, int>(); m_sounds = sounds; m_soundEmitter = new MyEntity3DSoundEmitter(m_drillEntity); }
public void ReceivedStepPacket(byte[] bytes) { try { long entId = BitConverter.ToInt64(bytes, 0); if(MyAPIGateway.Entities.EntityExists(entId)) { var ent = MyAPIGateway.Entities.GetEntityById(entId); var emitter = new MyEntity3DSoundEmitter(ent as MyEntity); emitter.PlaySound(soundStep, false, false, false); } } catch(Exception e) { Log.Error(e); } }
public MyReactor() { m_soundEmitter = new MyEntity3DSoundEmitter(this); }
internal void StartNoAmmoSound(MyEntity3DSoundEmitter soundEmitter) { if (NoAmmoSound != null) { soundEmitter.StopSound(true); soundEmitter.PlaySingleSound(NoAmmoSound, true); } }
public MyMedicalRoom() { m_idleSoundEmitter = new MyEntity3DSoundEmitter(this); m_progressSoundEmitter = new MyEntity3DSoundEmitter(this); m_progressSoundEmitter.EmitterMethods[MyEntity3DSoundEmitter.MethodsEnum.ShouldPlay2D].Add((Func<bool>) (() => MySession.ControlledEntity != null && m_user == MySession.ControlledEntity.Entity)); if (MySession.Static != null && MyFakes.ENABLE_NEW_SOUNDS && MySession.Static.Settings.RealisticSound) { m_progressSoundEmitter.EmitterMethods[MyEntity3DSoundEmitter.MethodsEnum.CanHear].Add((Func<bool>) (() => MySession.ControlledEntity != null && m_user == MySession.ControlledEntity.Entity)); } m_requiredPowerInput = MyEnergyConstants.MAX_REQUIRED_POWER_MEDICAL_ROOM/10f; }
public MyShipController() { ControllerInfo.ControlAcquired += OnControlAcquired; ControllerInfo.ControlReleased += OnControlReleased; GridSelectionSystem = new MyGridSelectionSystem(this); m_soundEmitter = new MyEntity3DSoundEmitter(this); }
static void emitter_StoppedPlaying(MyEntity3DSoundEmitter emitter) { if (emitter == null) return; m_emittersToRemove.Add(emitter); }
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 } } }
public MySmallMissileLauncher() { m_soundEmitter = new MyEntity3DSoundEmitter(this); }
public MyHandToolBase() { m_soundEmitter = new MyEntity3DSoundEmitter(this); }
public MyMeteorGameLogic() { m_soundEmitter = new MyEntity3DSoundEmitter(null); }
internal void StartShootSound(MyEntity3DSoundEmitter soundEmitter) { if (ShootSound != null) { if (soundEmitter.IsPlaying && !soundEmitter.Loop) soundEmitter.StopSound(true); soundEmitter.PlaySound(ShootSound, true); } }
public MyReactor() { m_soundEmitter = new MyEntity3DSoundEmitter(this); SourceComp = new MyResourceSourceComponent(); }
public MyMedicalRoom() { CreateTerminalControls(); m_idleSoundEmitter = new MyEntity3DSoundEmitter(this, true); m_progressSoundEmitter = new MyEntity3DSoundEmitter(this, true); m_progressSoundEmitter.EmitterMethods[MyEntity3DSoundEmitter.MethodsEnum.ShouldPlay2D].Add((Func<bool>)(() => MySession.Static.ControlledEntity != null && m_user == MySession.Static.ControlledEntity.Entity)); if (MySession.Static != null && MyFakes.ENABLE_NEW_SOUNDS && MySession.Static.Settings.RealisticSound) { m_progressSoundEmitter.EmitterMethods[MyEntity3DSoundEmitter.MethodsEnum.CanHear].Add((Func<bool>)(() => MySession.Static.ControlledEntity != null && m_user == MySession.Static.ControlledEntity.Entity)); } }