本文整理汇总了C#中Power类的典型用法代码示例。如果您正苦于以下问题:C# Power类的具体用法?C# Power怎么用?C# Power使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Power类属于命名空间,在下文中一共展示了Power类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPowerHeading
/// <summary>
/// Construct the heading for a power.
/// </summary>
/// <param name="power">
/// The <see cref="Power"/> to consturct the
/// </param>
/// <returns>
/// The header as a string encoded for HTML.
/// </returns>
/// <exception cref="ArgumentNullException">
/// No argument can be null.
/// </exception>
public string GetPowerHeading(Power power)
{
if (power == null)
{
throw new ArgumentNullException("power");
}
StringBuilder result;
List<string> additionalKeyWords;
result = new StringBuilder();
result.AppendFormat(string.Format("{0} ", power.Name));
additionalKeyWords = new List<string>();
additionalKeyWords.Add(CharacterRendererHelper.GetActionType(power.Action));
if (power is AttackPower)
{
additionalKeyWords.Add("attack");
}
else if (power.PowerSource != PowerSource.Item && power is UtilityPower)
{
additionalKeyWords.Add("utility");
}
result.AppendFormat("({0})", string.Join("; ", additionalKeyWords.ToArray()));
return result.ToString();
}
示例2: AggregatePower
public AggregatePower(string name, Power[] powers)
{
this.powers = powers;
this.name = name;
InitPower();
}
示例3: Shoot
static Shoot()
{
ShootAngles = new Angle[51, 600];
for (var p =5f; p < 10.01f; p += 0.1f)
{
for (var d = 200; d < 800; d++)
{
var d2 = d * d;
var power = new Power(p);
var speed = power.Speed;
for (var t = 1; t < 1024; t++)
{
var ball = BallPath.GetDistance(speed, t);
var player = PlayerPath.GetDistance(3, t, 40);
if (ball.Squared + player.Squared > d2)
{
var angle = Angle.Atan((double)player / (double)ball);
var spe = SpeedToKey(speed);
var dis = DistanceToKey(d);
ShootAngles[spe, dis] = angle;
break;
}
}
}
}
}
示例4: SetPower
// Set the dot's power rather than rely on randomised, used for end of PlayField
public void SetPower(Power newPower)
{
power = newPower;
if (power == Power.CLEARALLCOLOUR) {
texture.renderer.material.shader = Shader.Find ("Self-Illumin/Diffuse");
}
}
示例5: Start
public void Start(Power firmware)
{
var config = new RestApiConfiguration();
config.AddHandler("GET", "/boot/ping", "is server alive")
.ReturnNothing()
.HandledBy(() => {});
config.AddHandler("GET", "/boot/firmware", "get firmware info")
.ReturnJson()
.HandledBy(() => firmware.GetFirmwareInfoAsJson());
config.AddHandler("PUT", "/boot/firmware", "update firmware")
.ReturnJson()
.HandledWithStreamBy((s) => firmware.UpdateFirmware(s));
config.AddHandler("POST", "/boot/sysinfo", "get system state")
.ReturnJson()
.HandledBy(() => HardwareInfo.Instance.GetSystemInfo());
config.AddHandler("POST", "/boot/diskinfo", "list content of filesystem")
.ReturnJson()
.HandledBy(() => HardwareInfo.Instance.GetDiskInfo());
config.AddHandler("GET", "/boot/networks", "list network information")
.ReturnJson()
.HandledBy(() => HardwareInfo.Instance.GetNetworkInterfaceInfo());
config.AddHandler("GET", "/boot/log/full", "get full log")
.ReturnJson()
.HandledBy(() => Logger.Instance.Full.GetLinesAsJson());
config.AddHandler("GET", "/boot/log/errors", "get error log")
.ReturnJson()
.HandledBy(() => Logger.Instance.Errors.GetLinesAsJson());
config.AddHandler("POST", "/boot/ntp/sync", "sync time with NTP")
.ReturnJson()
.HandledBy(() =>
{
RealTimeClock.Instance.UpdateFromNTP();
var status = new JsonObject();
status.Add("time", DateTime.Now);
return status;
});
config.AddHandler("POST", "/boot/reboot", "reboot the device")
.SetNotes("This will reboot the device and not return")
.ReturnNothing()
.HandledBy(() => firmware.Reboot());
var credentials = CredentialValidatorFactory.CreateSimpleValidator("ChickenHouse", "admin", "hnsefyk");
var webService = new WebService(c_servicePort, credentials, config);
string prefix = Name + ": ";
webService.Logging.OnLogInfo += message => Logger.Instance.LogInfo(prefix + message);
webService.Logging.OnLogError += message => Logger.Instance.LogError(prefix + message);
webService.Logging.OnLogException += (message, ex) => Logger.Instance.LogException(prefix + message, ex);
webService.Start();
}
示例6: 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);
}
示例7: Shutdown
public void Shutdown(string comment, Power.ShutdownOptions options = Power.ShutdownOptions.Abort, string message = null,
int seconds = 30)
{
var minutes = seconds/60.0;
var timeDelay = (int) Math.Round(minutes);
Power.QueueShutdown($"-h +{timeDelay} \"{comment}\"", options, message);
}
示例8: OpAddition
public void OpAddition()
{
var power1 = new Power(6000, PowerUnit.Watts);
var power2 = new Power(1, PowerUnit.Kilowatts);
var expected = new Power(7000, PowerUnit.Watts);
(power1 + power2).ShouldEqual(expected);
(power2 + power1).ShouldEqual(expected);
}
示例9: DraculaCard
public DraculaCard(string abbreviation, Location location, Power power)
{
Abbreviation = abbreviation;
Location = location;
Power = power;
IsRevealed = false;
Color = ConsoleColor.DarkYellow;
}
示例10: Start
void Start()
{
openingSpeed = openingLength / openingTime;
leftClosedPos = left.localPosition;
rightClosedPos = right.localPosition;
power = GetComponent<Power>();
}
示例11: PowerCommand
public PowerCommand(MafiaGame game, VillageMember member, Power power)
{
this.game = game;
this.member = member;
this.power = power;
this.name = power.Name;
this.allowedInPublic = publicCommands.Contains(power.Name.ToLower());
}
示例12: FactionCommand
public FactionCommand(MafiaGame game, VillageMember member, Power power)
{
this.game = game;
this.member = member;
this.power = power;
this.name = power.Name;
this.allowedInPublic = false;
}
示例13: OpDivision
public void OpDivision()
{
var power1 = new Power(2000, PowerUnit.Watts);
var power2 = new Power(2, PowerUnit.Kilowatts);
(power1 / power2).ShouldBeWithinEpsilonOf(1);
(power2 / power1).ShouldBeWithinEpsilonOf(1);
(power1 / 2).ShouldEqual(new Power(1000, PowerUnit.Watts));
(power2 / 2).ShouldEqual(new Power(1, PowerUnit.Kilowatts));
}
示例14: OpInverseEquals
public void OpInverseEquals()
{
var power1 = new Power(3000, PowerUnit.Watts);
var power2 = new Power(3, PowerUnit.Kilowatts);
var power3 = new Power(5000, PowerUnit.NewtonMetersPerSecond);
(power1 != power2).ShouldBeFalse();
(power2 != power1).ShouldBeFalse();
(power1 != power3).ShouldBeTrue();
(power3 != power1).ShouldBeTrue();
}
示例15: OpGreaterThanOrEqual
public void OpGreaterThanOrEqual()
{
var power1 = new Power(3000, PowerUnit.Watts);
var power2 = new Power(3, PowerUnit.Kilowatts);
var power3 = new Power(5000, PowerUnit.NewtonMetersPerSecond);
(power1 >= power3).ShouldBeFalse();
(power3 >= power1).ShouldBeTrue();
(power1 >= power2).ShouldBeTrue();
(power2 >= power1).ShouldBeTrue();
}