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


C# Vector2i类代码示例

本文整理汇总了C#中Vector2i的典型用法代码示例。如果您正苦于以下问题:C# Vector2i类的具体用法?C# Vector2i怎么用?C# Vector2i使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ControlNode

            public ControlNode(Vector2i pos, float[,] map, Vector2 position, float size)
                : base(position)
            {
                Active = map[pos.x, pos.y];

                if (pos.x == map.GetLength(0))
                {
                    Right = new Node(position + Vector2.right * size * 0.5f);
                }
                else
                {
                    Right = new Node(position + Vector2.right * size * 0.5f);
                }

                if (pos.y == map.GetLength(1))
                {
                    Up = new Node(position + Vector2.up * size * 0.5f);
                }
                else
                {
                    Up = new Node(position + Vector2.up * size * 0.5f);
                }

                //float right = pos.x <  ? map[pos.x + 1, pos.y] : Active;
                //float up = map[pos.x, pos.y + 1];
            }
开发者ID:mfagerlund,项目名称:MC-Ubes,代码行数:26,代码来源:MeshGenerator.cs

示例2: GetActualPosition

    private static Vector2i? GetActualPosition(Vector2 position)
    {
        NavigationField navigationField = NavigationField.Instance;
        Vector2i pos = Vector2i.FromVector2Round(position);
        if (!navigationField.fieldSize.ContainsAsSize(pos))
        {
            return null;
        }

        if (!float.IsPositiveInfinity(navigationField.Costs[pos.x, pos.y]))
        {
            return pos;
        }

        // Try to find a nice neighbour...
        for (int y = -1; y <= 1; y++)
        {
            for (int x = -1; x <= 1; x++)
            {
                Vector2i test = new Vector2i(pos.x + x, pos.y + y);
                if (!float.IsPositiveInfinity(navigationField.GetCost(test)))
                {
                    return test;
                }
            }
        }

        return null;
    }
开发者ID:mfagerlund,项目名称:LD33,代码行数:29,代码来源:NavigationTool.cs

示例3: Job_PlantSeed

 public Job_PlantSeed(Vector2i plantPos, VoxelTypes seedType, IGrowPattern growPattern)
     : base(Labors.Farm, "Plant Seed", "Planting seed")
 {
     PlantPos = plantPos;
     SeedType = seedType;
     GrowPattern = growPattern;
 }
开发者ID:heyx3,项目名称:Elve,代码行数:7,代码来源:Job_PlantSeed.cs

示例4: OnMouseButton

        public static bool OnMouseButton(Controls.Control hoveredControl, int x, int y, bool down)
        {
            if (!down)
            {
                m_LastPressedControl = null;

                // Not carrying anything, allow normal actions
                if (CurrentPackage == null)
                    return false;

                // We were carrying something, drop it.
                onDrop(x, y);
                return true;
            }

            if (hoveredControl == null)
                return false;
            if (!hoveredControl.DragAndDrop_Draggable())
                return false;

            // Store the last clicked on control. Don't do anything yet,
            // we'll check it in OnMouseMoved, and if it moves further than
            // x pixels with the mouse down, we'll start to drag.
            m_LastPressedPos = new Vector2i(x, y);
            m_LastPressedControl = hoveredControl;

            return false;
        }
开发者ID:chartly,项目名称:flood,代码行数:28,代码来源:DragAndDrop.cs

示例5: Cannon

        public Cannon(Direction2D direction, Vector2i index)
        {
            _direction = direction;
            _worldIndex = index;

            _readOnlyBullets = new ReadOnlyCollection<Bullet>(_bullets);
        }
开发者ID:JaakkoLipsanen,项目名称:WVVW,代码行数:7,代码来源:Cannon.cs

示例6: SetField

 public override void SetField(Vector2i vect, char value)
 {
     if (IsEntryPointInTheSize(vect))
     {
         VarField[vect.X, vect.Y] = value;
     }
 }
开发者ID:Postremus,项目名称:UniTTT,代码行数:7,代码来源:Brett.cs

示例7: Next

 public static Vector2i Next(this Random random, Vector2i min, Vector2i max)
 {
     return new Vector2i(
         random.Next(min.X, max.X + 1),
         random.Next(min.Y, max.Y + 1)
     );
 }
开发者ID:nicolas-repiquet,项目名称:Granite,代码行数:7,代码来源:Extensions.cs

示例8: SendVector

 public void SendVector(Vector2i vect)
 {
     if (!(Player is Player.NetworkPlayer))
     {
         client.Send(string.Format("UniTTT!Vector:{0}", vect.ToString()));
     }
 }
开发者ID:Postremus,项目名称:UniTTT,代码行数:7,代码来源:NetworkGame.cs

示例9: ItemCollectedMessage

 /// <summary>
 /// Initializes a new instance of the <see cref="FreezingArcher.Messaging.ItemCollectedMessage"/> class.
 /// </summary>
 /// <param name="item">Item.</param>
 /// <param name="inventoryPosition">Inventory position.</param>
 /// <param name="entity">Entity.</param>
 public ItemCollectedMessage(Entity entity, ItemComponent item, Vector2i inventoryPosition)
 {
     Entity = entity;
     Item = item;
     InventoryPosition = inventoryPosition;
     MessageId = (int) Messaging.MessageId.ItemCollected;
 }
开发者ID:AreonDev,项目名称:NoWayOut,代码行数:13,代码来源:ItemCollectedMessage.cs

示例10: DistanceEstimate

        public double DistanceEstimate(Vector2i a, Vector2i b)
        {
            if (UseManhattanMetric)
                return Math.Abs(b.X - a.X) + Math.Abs(b.Y - a.Y);

            return Utils.Distance(new Vector2f(a.X, a.Y), new Vector2f(b.X, b.Y));
        }
开发者ID:deanljohnson,项目名称:PathView,代码行数:7,代码来源:SquareGrid.cs

示例11: Exit

 public Exit(Vector2i _pos)
     : base(_pos)
 {
     CurrentTex = "exit";
     Movable = false;
     Open = false;
 }
开发者ID:starboxgames,项目名称:superstarbox,代码行数:7,代码来源:Exit.cs

示例12: Setup

 public void Setup(RL.Map _map, int[] _dir)
 {
     map = _map;
     directions = _dir;
     lineRenderers = new GameObject[directions.Length];
     for (int i = 0; i < directions.Length; i++) {
         lineRenderers [i] = new GameObject ();
         lineRenderers [i].transform.parent = transform;
         lineRenderers [i].transform.position = transform.position;
         LineRenderer lr = lineRenderers [i].AddComponent<LineRenderer> ();
         lr.renderer.sortingOrder = 2;
         lr.renderer.sortingLayerName = "Default";
         lr.SetColors(new Color(74/255f,63/255f,148/255f, 0.5f), new Color(113/255f,138/255f,145/255f, 0.5f));
         lr.SetWidth (0.05f, 0.05f);
         lr.material = (Material)Resources.Load ("trapParticle");
         lr.useWorldSpace = false;
         // move out on the direction until we hit a wall, this is our endpoint
         Vector2i ndir = new Vector2i (RL.Map.nDir[directions[i],0], RL.Map.nDir[directions[i],1]);
         Vector2i np = GetComponent<RLCharacter>().positionI;
         int distanceCount = 1;
         np += ndir;
         while (map.IsOpenTile (np.x, np.y)) {
             np += ndir;
         }
     //			np -= ndir*0.5f;
         lr.SetPosition (0, Vector3.zero);
         lr.SetPosition (1, new Vector3(np.x-ndir.x*0.5f, np.y-ndir.y*0.5f, 0)-transform.position);
     }
 }
开发者ID:jonbro,项目名称:nightmare_cooperative,代码行数:29,代码来源:TrapDisplay.cs

示例13: Window

        /// <summary>
        /// Initializes a new instance of the <see cref="FreezingArcher.Core.Window"/> class.
        /// </summary>
        /// <param name="size">Windowed size.</param>
        /// <param name="resolution">Resolution of the framebuffer.</param>
        /// <param name="title">Title.</param>
        public Window (Vector2i size, Vector2i resolution, string title)
        {
            Logger.Log.AddLogEntry (LogLevel.Info, ClassName, "Creating new window '{0}'", title);
	    MSize = size;
	    MResolution = resolution;
	    MTitle = title;
        }
开发者ID:AreonDev,项目名称:NoWayOut,代码行数:13,代码来源:Window.cs

示例14: Stop

 public static void Stop(BHEntity mEntity, Vector2i mDirection, Rectangle mBounds, int mBoundsOffset)
 {
     if (mDirection.X == -1) mEntity.Position = new Vector2i(mBounds.X + mBoundsOffset, mEntity.Position.Y);
     if (mDirection.X == 1) mEntity.Position = new Vector2i(mBounds.X + mBounds.Width - mBoundsOffset, mEntity.Position.Y);
     if (mDirection.Y == -1) mEntity.Position = new Vector2i(mEntity.Position.X, mBounds.Y + mBoundsOffset);
     if (mDirection.Y == 1) mEntity.Position = new Vector2i(mEntity.Position.X, mBounds.Y - mBoundsOffset + mBounds.Height);
 }
开发者ID:SuperV1234,项目名称:VeeBulletHell,代码行数:7,代码来源:BHPresetOutOfBounds.cs

示例15: Update

        public override bool Update(Vector2i mouseS, IMapManager currentMap)
        {
            if (currentMap == null) return false;

            spriteToDraw = GetDirectionalSprite(pManager.CurrentBaseSpriteKey);

            mouseScreen = mouseS;
            mouseWorld = CluwneLib.ScreenToWorld(mouseScreen);

            var bounds = spriteToDraw.GetLocalBounds();
            var spriteSize = CluwneLib.PixelToTile(new Vector2f(bounds.Width, bounds.Height));
            var spriteRectWorld = new FloatRect(mouseWorld.X - (spriteSize.X / 2f),
                                                 mouseWorld.Y - (spriteSize.Y / 2f),
                                                 spriteSize.X, spriteSize.Y);

            if (pManager.CurrentPermission.IsTile)
                return false;

            if (pManager.CollisionManager.IsColliding(spriteRectWorld))
                return false;

            //if (currentMap.IsSolidTile(mouseWorld)) return false;

            var rangeSquared = pManager.CurrentPermission.Range * pManager.CurrentPermission.Range;
            if (rangeSquared > 0)
                if (
                    (pManager.PlayerManager.ControlledEntity.GetComponent<TransformComponent>(ComponentFamily.Transform)
                         .Position - mouseWorld).LengthSquared() > rangeSquared) return false;

            currentTile = currentMap.GetTileRef(mouseWorld);

            return true;
        }
开发者ID:MSylvia,项目名称:space-station-14,代码行数:33,代码来源:AlignNone.cs


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