本文整理汇总了C#中System.Vector2.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.Add方法的具体用法?C# Vector2.Add怎么用?C# Vector2.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector2
的用法示例。
在下文中一共展示了Vector2.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAddTwoVectors
public void TestAddTwoVectors()
{
var vRes = new Vector2(2.0, 2.0);
var vP = new Vector2(1.0, 1.0);
var vQ = new Vector2(1.0, 1.0);
var vZ = new Vector2(1.0, 2.0);
Assert.IsTrue(vRes == vP.Add(vQ));
Assert.IsTrue(vRes == vP + vQ);
Assert.IsFalse(vRes == vZ + vQ);
}
示例2: SignalComponent
//.........这里部分代码省略.........
return true;
}
case BlockType.InletPump:
case BlockType.OutletPump: {
if (signal == SignalType.Off)
return false;
PumpConfig pumpConfig;
PaintColor componentPaint = (PaintColor)TerrariaUtils.Tiles[measureData.OriginTileLocation].color();
if (
(
this.CircuitHandler.Config.PumpConfigs.TryGetValue(componentPaint, out pumpConfig) ||
this.CircuitHandler.Config.PumpConfigs.TryGetValue(PaintColor.None, out pumpConfig)
) &&
pumpConfig.Cooldown == 0 ||
WorldGen.checkMech(originX, originY, pumpConfig.Cooldown
)
) {
if (this.Result.SignaledPumps > this.CircuitHandler.Config.MaxPumpsPerCircuit) {
this.Result.WarnReason = CircuitWarnReason.SignalesTooManyPumps;
return true;
}
if (
pumpConfig.TriggerPermission != null &&
this.TriggeringPlayer != TSPlayer.Server &&
!this.TriggeringPlayer.Group.HasPermission(pumpConfig.TriggerPermission)
) {
this.Result.WarnReason = CircuitWarnReason.InsufficientPermissionToSignalComponent;
this.Result.WarnRelatedComponentType = measureData.BlockType;
return true;
}
if (measureData.BlockType == BlockType.InletPump)
this.SignaledInletPumps.Add(new DPoint(originX, originY));
else
this.SignaledOutletPumps.Add(new DPoint(originX, originY));
this.Result.SignaledPumps++;
}
return true;
}
case BlockType.DartTrap: {
if (signal == SignalType.Off)
return false;
TrapConfig trapConfig;
Tile componentTile = TerrariaUtils.Tiles[measureData.OriginTileLocation];
PaintColor componentPaint = (PaintColor)componentTile.color();
TrapStyle trapStyle = TerrariaUtils.Tiles.GetTrapStyle(componentTile.frameY / 18);
TrapConfigKey configKey = new TrapConfigKey(trapStyle, componentPaint);
TrapConfigKey defaultKey = new TrapConfigKey(trapStyle, PaintColor.None);
if (
(
this.CircuitHandler.Config.TrapConfigs.TryGetValue(configKey, out trapConfig) ||
this.CircuitHandler.Config.TrapConfigs.TryGetValue(defaultKey, out trapConfig)
) &&
trapConfig.Cooldown == 0 ||
WorldGen.checkMech(originX, originY, trapConfig.Cooldown
)
) {
if (this.Result.SignaledTraps > this.CircuitHandler.Config.MaxTrapsPerCircuit) {
this.Result.WarnReason = CircuitWarnReason.SignalesTooManyTraps;
return true;
}
if (