本文整理汇总了C#中Sandbox.Game.Entities.MySoundPair类的典型用法代码示例。如果您正苦于以下问题:C# MySoundPair类的具体用法?C# MySoundPair怎么用?C# MySoundPair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MySoundPair类属于Sandbox.Game.Entities命名空间,在下文中一共展示了MySoundPair类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public override void Init(MyComponentDefinitionBase definition)
{
base.Init(definition);
var craftDefinition = definition as MyCraftingComponentBasicDefinition;
System.Diagnostics.Debug.Assert(craftDefinition != null, "Trying to initialize crafting component from wrong definition type?");
if (craftDefinition != null)
{
ActionSound = new MySoundPair(craftDefinition.ActionSound);
m_craftingSpeedMultiplier = craftDefinition.CraftingSpeedMultiplier;
foreach (var blueprintClass in craftDefinition.AvailableBlueprintClasses)
{
var classDefinition = MyDefinitionManager.Static.GetBlueprintClass(blueprintClass);
System.Diagnostics.Debug.Assert(classDefinition != null, blueprintClass + " blueprint class definition was not found.");
if (classDefinition != null)
{
m_blueprintClasses.Add(classDefinition);
}
}
}
}
示例2: MyWeaponAmmoData
public MyWeaponAmmoData(int rateOfFire, string soundName, int shotsInBurst)
{
this.RateOfFire = rateOfFire;
this.ShotsInBurst = shotsInBurst;
this.ShootSound = new MySoundPair(soundName);
this.ShootIntervalInMiliseconds = (int)(1000 / (RateOfFire * oneSixtieth));
}
示例3: ImpactSounds
public ImpactSounds(float mass, string soundCue, float minVelocity, float maxVolumeVelocity)
{
this.Mass = mass;
this.SoundCue = new MySoundPair(soundCue);
this.minVelocity = minVelocity;
this.maxVolumeVelocity = maxVolumeVelocity;
}
示例4: 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();
}
示例5: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = builder as MyObjectBuilder_WeaponDefinition;
MyDebug.AssertDebug(ob != null);
this.WeaponAmmoDatas = new MyWeaponAmmoData[Enum.GetValues(typeof(MyAmmoType)).Length];
this.NoAmmoSound = new MySoundPair(ob.NoAmmoSoundName);
this.ReloadSound = new MySoundPair(ob.ReloadSoundName);
this.DeviateShotAngle = MathHelper.ToRadians(ob.DeviateShotAngle);
this.ReleaseTimeAfterFire = ob.ReleaseTimeAfterFire;
this.MuzzleFlashLifeSpan = ob.MuzzleFlashLifeSpan;
this.AmmoMagazinesId = new MyDefinitionId[ob.AmmoMagazines.Length];
for (int i = 0; i < this.AmmoMagazinesId.Length; i++)
{
var ammoMagazine = ob.AmmoMagazines[i];
this.AmmoMagazinesId[i] = new MyDefinitionId(ammoMagazine.Type, ammoMagazine.Subtype);
var ammoMagazineDefinition = MyDefinitionManager.Static.GetAmmoMagazineDefinition(this.AmmoMagazinesId[i]);
MyAmmoType ammoType = MyDefinitionManager.Static.GetAmmoDefinition(ammoMagazineDefinition.AmmoDefinitionId).AmmoType;
string errorMessage = null;
switch (ammoType)
{
case MyAmmoType.HighSpeed:
MyDebug.AssertDebug(ob.ProjectileAmmoData != null, "No weapon ammo data specified for projectile ammo");
if (ob.ProjectileAmmoData != null)
{
this.WeaponAmmoDatas[(int)MyAmmoType.HighSpeed] = new MyWeaponAmmoData(ob.ProjectileAmmoData);
}
else
{
errorMessage = string.Format(ErrorMessageTemplate, "projectile", "Projectile");
}
break;
case MyAmmoType.Missile:
MyDebug.AssertDebug(ob.MissileAmmoData != null, "No weapon ammo data specified for missile ammo");
if (ob.MissileAmmoData != null)
{
this.WeaponAmmoDatas[(int)MyAmmoType.Missile] = new MyWeaponAmmoData(ob.MissileAmmoData);
}
else
{
errorMessage = string.Format(ErrorMessageTemplate, "missile", "Missile");
}
break;
default:
throw new NotImplementedException();
}
if (!string.IsNullOrEmpty(errorMessage))
{
MyDefinitionErrors.Add(Context, errorMessage, TErrorSeverity.Critical);
}
}
}
示例6: MaterialProperties
public MaterialProperties(MySoundPair soundCue, string particleEffectName, ContactPropertyParticleProperties effectProperties)
{
Sound = soundCue;
ParticleEffectProperties = effectProperties;
if (particleEffectName != null)
MyParticlesLibrary.GetParticleEffectsID(
particleEffectName, out ParticleEffectID);
else
ParticleEffectID = -1;
}
示例7: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var obProjector = builder as MyObjectBuilder_ProjectorDefinition;
MyDebug.AssertDebug(obProjector != null, "Initializing camera definition using wrong object builder.!");
ResourceSinkGroup = MyStringHash.GetOrCompute(obProjector.ResourceSinkGroup);
RequiredPowerInput = obProjector.RequiredPowerInput;
IdleSound = new MySoundPair(obProjector.IdleSound);
}
示例8: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var chamberDef = builder as MyObjectBuilder_CryoChamberDefinition;
OverlayTexture = chamberDef.OverlayTexture;
IdlePowerConsumption = chamberDef.IdlePowerConsumption;
OutsideSound = new MySoundPair(chamberDef.OutsideSound);
InsideSound = new MySoundPair(chamberDef.InsideSound);
}
示例9: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var obDefinition = builder as MyObjectBuilder_OxygenGeneratorDefinition;
this.IceToOxygenRatio = obDefinition.IceToOxygenRatio;
this.OxygenProductionPerSecond = obDefinition.OxygenProductionPerSecond;
this.GenerateSound = new MySoundPair(obDefinition.GenerateSound);
this.IdleSound = new MySoundPair(obDefinition.IdleSound);
}
示例10: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var ob = builder as MyObjectBuilder_ShipSoundsDefinition;
MyDebug.AssertDebug(ob != null);
this.MinWeight = ob.MinWeight;
this.AllowSmallGrid = ob.AllowSmallGrid;
this.AllowLargeGrid = ob.AllowLargeGrid;
this.EnginePitchRangeInSemitones = ob.EnginePitchRangeInSemitones;
this.EnginePitchRangeInSemitones_h = ob.EnginePitchRangeInSemitones * -0.5f;
this.EngineTimeToTurnOn = ob.EngineTimeToTurnOn;
this.EngineTimeToTurnOff = ob.EngineTimeToTurnOff;
this.WheelsLowerThrusterVolumeBy = ob.WheelsLowerThrusterVolumeBy;
this.WheelsFullSpeed = ob.WheelsFullSpeed;
this.ThrusterCompositionMinVolume = ob.ThrusterCompositionMinVolume;
this.ThrusterCompositionMinVolume_c = ob.ThrusterCompositionMinVolume / (1f - ob.ThrusterCompositionMinVolume);
this.ThrusterCompositionChangeSpeed = ob.ThrusterCompositionChangeSpeed;
this.SpeedDownSoundChangeVolumeTo = ob.SpeedDownSoundChangeVolumeTo;
this.SpeedUpSoundChangeVolumeTo = ob.SpeedUpSoundChangeVolumeTo;
this.SpeedUpDownChangeSpeed = ob.SpeedUpDownChangeSpeed * MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS;
foreach (var sound in ob.Sounds)
{
if(sound.SoundName.Length == 0)
continue;
MySoundPair soundPair = new MySoundPair(sound.SoundName);
if (soundPair != MySoundPair.Empty)
this.Sounds.Add(sound.SoundType, soundPair);
}
List<MyTuple<float, float>> thrusterVolumesTemp = new List<MyTuple<float,float>>();
foreach (var thrusterVolume in ob.ThrusterVolumes)
{
thrusterVolumesTemp.Add(new MyTuple<float, float>(Math.Max(0f, thrusterVolume.Speed), Math.Max(0f, thrusterVolume.Volume)));
}
this.ThrusterVolumes = thrusterVolumesTemp.OrderBy(o => o.Item1).ToList();
List<MyTuple<float, float>> engineVolumesTemp = new List<MyTuple<float, float>>();
foreach (var engineVolume in ob.EngineVolumes)
{
engineVolumesTemp.Add(new MyTuple<float, float>(Math.Max(0f, engineVolume.Speed), Math.Max(0f, engineVolume.Volume)));
}
this.EngineVolumes = engineVolumesTemp.OrderBy(o => o.Item1).ToList();
List<MyTuple<float, float>> wheelsVolumesTemp = new List<MyTuple<float, float>>();
foreach (var wheelsVolume in ob.WheelsVolumes)
{
wheelsVolumesTemp.Add(new MyTuple<float, float>(Math.Max(0f, wheelsVolume.Speed), Math.Max(0f, wheelsVolume.Volume)));
}
this.WheelsVolumes = wheelsVolumesTemp.OrderBy(o => o.Item1).ToList();
}
示例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();
}
示例12: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
var ob = (MyObjectBuilder_RopeDefinition)builder;
this.EnableRayCastRelease = ob.EnableRayCastRelease;
this.IsDefaultCreativeRope = ob.IsDefaultCreativeRope;
this.ColorMetalTexture = ob.ColorMetalTexture;
this.NormalGlossTexture = ob.NormalGlossTexture;
this.AddMapsTexture = ob.AddMapsTexture;
if (!string.IsNullOrEmpty(ob.AttachSound)) this.AttachSound = new MySoundPair(ob.AttachSound);
if (!string.IsNullOrEmpty(ob.DetachSound)) this.DetachSound = new MySoundPair(ob.DetachSound);
if (!string.IsNullOrEmpty(ob.WindingSound)) this.WindingSound = new MySoundPair(ob.WindingSound);
base.Init(builder);
}
示例13: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var airVent = builder as MyObjectBuilder_AirVentDefinition;
MyDebug.AssertDebug(airVent != null, "Initializing air vent definition using wrong object builder.");
StandbyPowerConsumption = airVent.StandbyPowerConsumption;
OperationalPowerConsumption = airVent.OperationalPowerConsumption;
VentilationCapacityPerSecond = airVent.VentilationCapacityPerSecond;
PressurizeSound = new MySoundPair(airVent.PressurizeSound);
DepressurizeSound = new MySoundPair(airVent.DepressurizeSound);
IdleSound = new MySoundPair(airVent.IdleSound);
}
示例14: CollisionProperty
public CollisionProperty(string soundCue, string particleEffectName, List<AlternativeImpactSounds> impactsounds)
{
Sound = new MySoundPair(soundCue);
ParticleEffect = particleEffectName;
if (impactsounds == null || impactsounds.Count == 0)
ImpactSoundCues = null;
else
{
ImpactSoundCues = new List<ImpactSounds>();
foreach (var impactSound in impactsounds)
{
ImpactSoundCues.Add(new ImpactSounds(impactSound.mass, impactSound.soundCue, impactSound.minVelocity, impactSound.maxVolumeVelocity));
}
}
}
示例15: Init
protected override void Init(MyObjectBuilder_DefinitionBase builder)
{
base.Init(builder);
var obDefinition = builder as MyObjectBuilder_OxygenGeneratorDefinition;
IceConsumptionPerSecond = obDefinition.IceConsumptionPerSecond;
GenerateSound = new MySoundPair(obDefinition.GenerateSound);
IdleSound = new MySoundPair(obDefinition.IdleSound);
ResourceSourceGroup = MyStringHash.GetOrCompute(obDefinition.ResourceSourceGroup);
ProducedGases = null;
if (obDefinition.ProducedGases != null)
{
ProducedGases = new List<MyGasGeneratorResourceInfo>(obDefinition.ProducedGases.Count);
foreach(var producedGasInfo in obDefinition.ProducedGases)
ProducedGases.Add(producedGasInfo);
}
}