当前位置: 首页>>代码示例>>C#>>正文


C# Vector2.Add方法代码示例

本文整理汇总了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);
        }
开发者ID:kridy,项目名称:3DMath,代码行数:11,代码来源:Vector2MathFixture.cs

示例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 (
开发者ID:Enerdy,项目名称:AdvancedCircuits-Plugin,代码行数:67,代码来源:CircuitProcessor.cs


注:本文中的System.Vector2.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。