本文整理汇总了C#中Volume类的典型用法代码示例。如果您正苦于以下问题:C# Volume类的具体用法?C# Volume怎么用?C# Volume使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Volume类属于命名空间,在下文中一共展示了Volume类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BlocksInVolume
/// <summary>Iterates over all the blocks contained in a volume.</summary>
public static void BlocksInVolume(Volume volume, Action<CoordinateInt> action)
{
for (int x = 0; x < volume.ScaleX; x++)
for (int y = 0; y < volume.ScaleY; y++)
for (int z = 0; z < volume.ScaleZ; z++)
action(volume.Coord.Offset(x, y, z));
}
示例2: analyzeAudio
public void analyzeAudio(byte[] audioBuffer, float[] energy)
{
this.audioBuffer = audioBuffer;
this.energy = energy;
this.averageVolume = 0;
calcAverageVolume();
calcIsSpeaking();
if(isSpeaking)
{
TimeSpan speaking = new TimeSpan(startedSpeaking.Ticks);
TimeSpan now = new TimeSpan(DateTime.Now.Ticks);
if (now.TotalMilliseconds - speaking.TotalMilliseconds > ThresholdActuallySpeaking)
{
assignSpeakingVolume();
calcSpeakingTime();
}
else
{
voiceVolume = Volume.good;
calcPausingTime();
}
}
else
{
voiceVolume = Volume.good;
calcPausingTime();
}
}
示例3: AdjustVolume
public void AdjustVolume(Volume volume)
{
switch (volume)
{
case Volume.low:
MasterVolume = volume;
break;
case Volume.medium:
MasterVolume = volume;
break;
case Volume.medium_high:
MasterVolume = volume;
break;
case Volume.high:
MasterVolume = volume;
break;
case Volume.mute:
masterVolume = 0f;
MasterVolume = volume;
break;
default:
AdjustVolume(Volume.medium);
break;
}
}
示例4: VerifyAllEnums
public void VerifyAllEnums()
{
var acceleration = new Acceleration(1, AccelerationUnit.BaseUnit);
var angle = new Angle(1, AngleUnit.BaseUnit);
var angularAcceleration = new AngularAcceleration(1, AngularAccelerationUnit.BaseUnit);
var area = new Area(1, AreaUnit.BaseUnit);
var density = new MassDensity(1, MassDensityUnit.BaseUnit);
var electricCurrent = new ElectricCurrent(1, ElectricCurrentUnit.BaseUnit);
var electricResistance = new ElectricResistance(1, ElectricResistanceUnit.BaseUnit);
var electricVoltage = new ElectricPotential(1, ElectricPotentialUnit.BaseUnit);
var energy = new Energy(1, EnergyUnit.BaseUnit);
var force = new Force(1, ForceUnit.BaseUnit);
var frequency = new Frequency(1, FrequencyUnit.BaseUnit);
var jerk = new Jerk(1, JerkUnit.BaseUnit);
var length = new Length(1, LengthUnit.BaseUnit);
var mass = new Mass(1, MassUnit.BaseUnit);
var massFlowRate = new MassFlowRate(1, MassFlowRateUnit.BaseUnit);
var momentum = new Momentum(1, MomentumUnit.BaseUnit);
var numeric = new Numeric(1, NumericUnit.BaseUnit);
var power = new Power(1, PowerUnit.BaseUnit);
var pressure = new Pressure(1, PressureUnit.BaseUnit);
var speed = new Speed(1, SpeedUnit.BaseUnit);
var temperature = new Temperature(1, TemperatureUnit.BaseUnit);
var time = new Time(1, TimeUnit.BaseUnit);
var torque = new Torque(1, TorqueUnit.BaseUnit);
var volume = new Volume(1, VolumeUnit.BaseUnit);
var volumetricFlowRate = new VolumetricFlowRate(1, VolumetricFlowRateUnit.BaseUnit);
}
示例5: detector_Collided
void detector_Collided(Volume collisonObject, Voxel voxel, Vector3 worldPosition)
{
// If the bullet hits an invader and is owned by the player, explode and destroy the invader - and deactivate the bullet
if (collisonObject.name == "Invader" && Owner is InvadersPlayerShip)
{
collisonObject.Destruct(3f, true);
Destroy(collisonObject.gameObject);
gameObject.SetActive(false);
}
// If we hit a shield, just explode and deactivate the bullet
if (collisonObject.name == "Shield")
{
exploder.ExplosionRadius = 1f;
exploder.Explode();
gameObject.SetActive(false);
}
// If we hit the player ship
if (collisonObject.name == "Player Ship")
{
collisonObject.Destruct(3f, true);
collisonObject.GetComponent<InvadersPlayerShip>().Die();
gameObject.SetActive(false);
}
}
示例6: GetVolume
public Volume GetVolume(string ComicVineVolumeRequestXMLResponse)
{
var volume = new Volume();
var xDoc = XDocument.Parse(ComicVineVolumeRequestXMLResponse);
volume.id = ParseHelper.ParseInt((string)xDoc.Descendants("id").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "0");
volume.name = (string)xDoc.Descendants("name").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "";
volume.description = (string)xDoc.Descendants("description").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "";
volume.dateAdded = ParseHelper.ParseDateTime((string)xDoc.Descendants("date_added").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "");
volume.dateLastUpdated = ParseHelper.ParseDateTime((string)xDoc.Descendants("date_last_updated").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "");
volume.countOfIssues = ParseHelper.ParseInt((string)xDoc.Descendants("count_of_issues").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "0");
volume.startYear = ParseHelper.ParseInt((string)xDoc.Descendants("start_year").Where(p => p.Parent.Name.LocalName == "results").FirstOrDefault() ?? "0");
volume.publisherId = ParseHelper.ParseInt((string)xDoc.Descendants("id").Where(p => p.Parent.Name.LocalName == "publisher").FirstOrDefault() ?? "0");
volume.collectable = true;
if (volume.dateLastUpdated > DateTime.Now.AddMonths(-13))
{
volume.complete = false;
}
else
{
volume.complete = true;
}
reprintDetector.DetectReprint(volume);
return volume;
}
示例7: VolumeCreate
public void VolumeCreate()
{
Configure();
volume = new Volume
{
Properties = new VolumeProperties
{
Size = 4,
Image = imageId,
Type = "HDD",
Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(),
SshKeys = new System.Collections.Generic.List<string> { "hQGOEJeFL91EG3+l9TtRbWNjzhDVHeLuL3NWee6bekA=" }
}
};
volume = volumeApi.Create(datacenter.Id, volume);
bool isBusy = true;
while (isBusy == true)
{
var dc = dcApi.FindById(datacenter.Id);
if (dc.Metadata.State != "BUSY") isBusy = false;
Thread.Sleep(1500);
}
Assert.IsNotNull(volume);
}
示例8: Power_LengthRaisedWith3_ReturnsVolume
public void Power_LengthRaisedWith3_ReturnsVolume()
{
var expected = new Volume(1.0, Volume.CubicDeciMeter);
var len = new Measure<Length>(1.0, Length.DeciMeter);
Volume actual; ArithmeticOperations.Power(len, 3, out actual);
MeasureAssert.AmountsAreEqual(expected, actual);
}
示例9: can_use_mass_volume_constructor
[Test] public void can_use_mass_volume_constructor() {
Mass m = new Mass(10, MassUnit.Pounds);
Volume v = new Volume(2, VolumeUnit.Gallons);
var d = new Density(m, v);
d.Mass.ShouldEqual(m);
d.Volume.ShouldEqual(v);
}
示例10: InitAudio
public void InitAudio()
{
gameVolume = GameObject.Find("2DAudio").GetComponent<Volume>();
if (GameObject.Find("musicSlider") != null &&
GameObject.Find("soundFXSlider")!= null &&
GameObject.Find("dialogueSlider") != null)
{
musicSlider = GameObject.Find("musicSlider").GetComponent<UISlider>();
soundFXSlider = GameObject.Find("soundFXSlider").GetComponent<UISlider>();
dialogueSlider = GameObject.Find("dialogueSlider").GetComponent<UISlider>();
if (!PlayerPrefs.HasKey("MusicVol"))
gameVolume.MusicVolume = musicSlider.value;
else
musicSlider.value = PlayerPrefs.GetFloat("MusicVol");
if (!PlayerPrefs.HasKey("SoundFXVol"))
gameVolume.AmbienceVolume = soundFXSlider.value;
else
soundFXSlider.value = PlayerPrefs.GetFloat("SoundFXVol");
if (!PlayerPrefs.HasKey("DialogueVol"))
gameVolume.AIVolume = dialogueSlider.value;
else
dialogueSlider.value = PlayerPrefs.GetFloat("DialogueVol");
}
}
示例11: OpAddition
public void OpAddition()
{
var volume1 = new Volume(3600, VolumeUnit.Liters);
var volume2 = new Volume(1, VolumeUnit.CubicMeters);
var expected = new Volume(4600, VolumeUnit.Liters);
(volume1 + volume2).ShouldEqual(expected);
(volume2 + volume1).ShouldEqual(expected);
}
示例12: detector_Collided
private void detector_Collided(Volume collisonObject, Voxel voxel, Vector3 worldPosition)
{
if (collisonObject.name.StartsWith("Plane") && Owner is ShmupChopper)
{
collisonObject.GetComponent<ShmupPlane>().Die();
gameObject.SetActive(false);
}
}
示例13: Times_MultiplyAreaAndLength_ReturnsVolume
public void Times_MultiplyAreaAndLength_ReturnsVolume()
{
var expected = new Volume(6.0);
var lhs = new Area(2.0);
var rhs = new Length(3.0);
Volume actual; ArithmeticOperations.Times(lhs, rhs, out actual);
MeasureAssert.MeasuresAreEqual(expected, actual);
}
示例14: Divide_DivideVolumeAndLength_ReturnsArea
public void Divide_DivideVolumeAndLength_ReturnsArea()
{
var expected = new Area(4.0);
var numerator = new Volume(8.0);
var denominator = new Length(200.0, Length.CentiMeter);
Area actual; ArithmeticOperations.Divide(numerator, denominator, out actual);
MeasureAssert.MeasuresAreEqual(expected, actual);
}
示例15: Shape
public Shape(Point center, Volume volume, Contour contour, ConvexHull convexHull, IList<Point> points)
{
this.center = center;
this.volume = volume;
this.contour = contour;
this.convexHull = convexHull;
this.points = points;
}