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


C# Point.ToVector2方法代码示例

本文整理汇总了C#中Point.ToVector2方法的典型用法代码示例。如果您正苦于以下问题:C# Point.ToVector2方法的具体用法?C# Point.ToVector2怎么用?C# Point.ToVector2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point的用法示例。


在下文中一共展示了Point.ToVector2方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PointToVector2

 public void PointToVector2()
 {
     var pt = new Point(-3, 5);
     var actual = pt.ToVector2();
     var expected = new System.Numerics.Vector2(-3, 5);
     Assert.AreEqual(expected, actual);
 }
开发者ID:Mirandatz,项目名称:Trauer,代码行数:7,代码来源:PointTests.cs

示例2: UpdateGridPosition

 void UpdateGridPosition(Point position, bool warp)
 {
   _targetPos = position;
   if (warp)
   {
     FinishMove();
     transform.position = _targetPos.ToVector2() * gridCellSize;
   }
   else
   {
     StartMove();
   }
 }
开发者ID:wow4all,项目名称:Walker,代码行数:13,代码来源:GridTransform.cs

示例3: Draw

        public override void Draw(SpriteBatch sb)
        {
            if (tiles == null || tiles.Length != BrushSize || tiles[0][0] != BaseTile) {
                tiles = UtilityFramework.Util.GetInitialized2DArray<Tile>(BrushSize, BrushSize, BaseTile);
            }

            for (int x = 0; x < BrushSize; x++) {
                for (int y = 0; y < BrushSize; y++) {
                    Point p = new Point(Origin.X + x - BrushSize / 2, Origin.Y + y - BrushSize / 2);
                    if (p.X >= 0 && p.Y >= 0 && p.X < Map.Settings.Dimensions.XCount && p.Y < Map.Settings.Dimensions.YCount && Map.GetTileAt(p.X, p.Y) != BaseTile) {
                        tiles[x][y].Draw(sb, p.ToVector2() * Map.Settings.TileSize + Map.Settings.TileSize / 2.0f, Color.White);
                    }
                }
            }
        }
开发者ID:GaiiusBaltar,项目名称:XNA-Top-Down-Map-Editor,代码行数:15,代码来源:TileTools.cs

示例4: AnimatedBackground

        public AnimatedBackground(string texture, Point worldDimensions, int segmentSeed)
        {
            _texture = "anim-" + texture;
            _worldDimensions = worldDimensions.ToVector2();

            _generatorSeed = segmentSeed;
            _generatorLastValue = 0;
            _generatorIteration = 0;
            _segmentSequenceIndex = 0;

            CalculateBackgroundTargetArea();
            RenderLayer = Render_Layer;
            Visible = true;
            Wrap = false;

            SetCloudMetrics(texture);
        }
开发者ID:Ben-P-Leda,项目名称:Bopscotch-Android,代码行数:17,代码来源:AnimatedBackground.cs

示例5: Contains

 public bool Contains(Point point)
 {
     return Shape.Contains(point.ToVector2());
 }
开发者ID:detuur,项目名称:MonoGame.Extended,代码行数:4,代码来源:GuiControl.cs

示例6: HandlePointerPressed

        private void HandlePointerPressed(Point position, bool isLeft, bool isRight)
        {

            var pointerPos = position.ToVector2();
            if (isLeft)
            {
                bool newSelection = false;
                Tank tempTank = null;
                //check if something get selected
                foreach (var tank in Tanks)
                {

                    if (tank.selected)
                    {
                        tempTank = tank;
                    }
                    if (!newSelection && Vector2.Distance(pointerPos, tank.CurrentPosition) < tank.size)
                    {
                        tank.selected = true;
                        isTankSelected = true;
                        newSelection = true;

                    }
                    else
                    {
                        tank.selected = false;
                    }

                }
                if (!newSelection && tempTank != null)
                {
                    tempTank.TargetPosition = pointerPos;
                    tempTank.selected = true;
                }
            }
            else if (isRight)
            {
                this.FiringTargetPos = pointerPos;
                this.FireCommand = true;
            }

        }
开发者ID:bastiankayser,项目名称:Win2DTestProject,代码行数:42,代码来源:MainPage.xaml.cs

示例7: WorldToGrid

 /// <summary>
 /// Convert screen coordinates in grid ones
 /// </summary>
 /// <param name="absolutePoint"></param>
 /// <returns></returns>
 public static Vector2 WorldToGrid(Point absolutePoint, Vector2 tileSize)
 {
     return WorldToGrid(absolutePoint.ToVector2(), tileSize);
 }
开发者ID:yaki4,项目名称:super-caissiere,代码行数:9,代码来源:Grid.cs

示例8: Play

        public static SoundEffectInstance Play(SfxEntry entry, Point tilePos, int variant, float volMod = Single.NaN, float pitch = Single.NaN, float panMod = Single.NaN)
        {
            return Play(entry, tilePos.ToVector2() * 16f, variant, (SfxEntry e, Vector2 p, ref int v, ref float vol, ref float pi, ref float pan) =>
            {
                if (!Single.IsNaN(vol))
                    vol *= volMod;
                if (!Single.IsNaN(pi))
                    pi = pitch;
                if (!Single.IsNaN(pan))
                    pan *= panMod;

                return true;
            });
        }
开发者ID:TerrariaPrismTeam,项目名称:Prism,代码行数:14,代码来源:Sfx.cs

示例9: SetPosition

 public void SetPosition(Point pos)
 {
     this.Position = pos.ToVector2();
     //this.SetPosition(pos.X, pos.Y);
 }
开发者ID:vitormoura,项目名称:Laboratorio,代码行数:5,代码来源:Sprite.cs

示例10: Contains

 public bool Contains(Point point)
 {
     return BoundingRectangle.Contains(point.ToVector2());
 }
开发者ID:stromkos,项目名称:MonoGame.Extended,代码行数:4,代码来源:GuiControl.cs

示例11: AddTeleportObject

 public void AddTeleportObject(Point groundPoint, Point assetSize, Texture2D texture, bool isVisible, Point destination)
 {
     TeleportComponent teleComp = new TeleportComponent(texture.Width, texture.Height, destination);
     GameObject tempObject = new GameObject(groundPoint.ToVector2(), texture, isVisible, teleComp);
     tempObject.Size = assetSize;
     LevelObjects.Add(tempObject);
 }
开发者ID:TheGameDevelopmentClub,项目名称:glitch,代码行数:7,代码来源:Level.cs

示例12: UniversoAVentana

		/// <summary>
		/// Convierte de universo a ventana
		/// </summary>
		public Point UniversoAVentana (Point p)
		{
			return UniversoAVentana (p.ToVector2 ()).ToPoint ();
		}
开发者ID:karv,项目名称:Moggle,代码行数:7,代码来源:VisualPortManager.cs

示例13: AddTrampolineObject

 public void AddTrampolineObject(Point groundPoint, Point assetSize, Texture2D texture, bool isVisible, float jumpMagnifier)
 {
     TrampolineComponent trampComp = new TrampolineComponent(texture.Width, texture.Height, jumpMagnifier);
     GameObject tempObject = new GameObject(groundPoint.ToVector2(), texture, isVisible, trampComp);
     tempObject.Size = assetSize;
     LevelObjects.Add(tempObject);
 }
开发者ID:TheGameDevelopmentClub,项目名称:glitch,代码行数:7,代码来源:Level.cs

示例14: AddObject

 public void AddObject(Point groundPoint, Texture2D texture, bool isVisible)
 {
     GameObject tempGameObject = new GameObject(groundPoint.ToVector2(), texture, isVisible, PhysicsType.StaticObject);
     LevelObjects.Add(tempGameObject);
 }
开发者ID:TheGameDevelopmentClub,项目名称:glitch,代码行数:5,代码来源:Level.cs

示例15: LoadExitTile

        /// <summary>
        /// Remembers the location of the level's exit.
        /// </summary>
        private Tile LoadExitTile(int x, int y)
        {
            if (exit != InvalidPosition)
                throw new NotSupportedException("A level may only have one exit.");

            exit = GetBounds(x, y).Center;
            Game.Penumbra.Lights.Add(new PointLight
            {
                Position = exit.ToVector2(),
                Scale = new Vector2(100),
                Color = Color.Red,
                CastsShadows = false
            });

            return LoadTile("Exit", TileCollision.Passable);
        }
开发者ID:infinitespace-studios,项目名称:penumbra,代码行数:19,代码来源:Level.cs


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