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


C# Vector2.ToVector3方法代码示例

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


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

示例1: IsCondemnable

        private static bool IsCondemnable(Vector2 from, Obj_AI_Base unit, int range)
        {
            if(from.ToVector3().GetTumbleEndPos().Distance(unit) < 300 || !from.IsInRange(unit, 425))
                return false;

            var position = Prediction.Position.GetPrediction(unit, new Prediction.Position.PredictionData(Prediction.Position.PredictionData.PredictionType.Linear, Settings.PushDistance, 80, 0, 550, 1800)).UnitPosition.To2D();

            for (var i = range; i >= 100; i -= 100)
            {
                var vec = position.Extend(from, -i);

                const int var = 18 * 4 / 100;

                var left = position.Extend(
                    vec + (position - vec).Normalized().Rotated((float) Helpers.ToRadian(Math.Max(0, var)))*
                    Math.Abs(i < 200 ? 50 : 60*4), i);

                var right = position.Extend(
                    vec + (position - vec).Normalized().Rotated((float) Helpers.ToRadian(-Math.Max(0, var)))*
                    Math.Abs(i < 200 ? 50 : 60*4), i);

                if (left.IsWall() && right.IsWall() && vec.IsWall())
                {
                    return true;
                }
            }
            return false;
        }
开发者ID:FireBuddy,项目名称:EloBuddy-Addons,代码行数:28,代码来源:FlashCondemn.cs

示例2: FixedCamera2D

        /// <summary>
        /// Initializes a new instance of the <see cref="FixedCamera2D" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="position">The camera position</param>
        public FixedCamera2D(string name, Vector2 position)
        {
            this.InitEntity(name);

            Vector3 position3D = position.ToVector3(-10);
            this.entity.FindComponent<Transform3D>(false).Position = position3D;
        }
开发者ID:nagyistoce,项目名称:WaveEngine-Components,代码行数:12,代码来源:FixedCamera2D.cs

示例3: Condemn360

        public static bool Condemn360(Obj_AI_Hero unit, int push, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) ||
                _lastCheck + 50 > Environment.TickCount || ObjectManager.Player.IsDashing())
            {
                return false;
            }

            var prediction = E.GetPrediction(unit);
            var predictionsList = pos.IsValid() ? new List<Vector3>() { pos.ToVector3() } : new List<Vector3>
                        {
                            unit.ServerPosition,
                            unit.Position,
                            prediction.CastPosition,
                            prediction.UnitPosition
                        };

            var wallsFound = 0;
            _points = new List<Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < push; i += (int)unit.BoundingRadius) // 420 = push distance
                {
                    var cPos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).ToVector2();
                    _points.Add(cPos);
                    if (NavMesh.GetCollisionFlags(cPos.ToVector3()).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos.ToVector3()).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }

            // ReSharper disable once PossibleLossOfFraction
            if ((wallsFound / predictionsList.Count) >= 33 / 100f)
            {
                return true;
            }

            return false;
        }
开发者ID:HikigayaAss,项目名称:LeagueSharpSDK,代码行数:41,代码来源:Condemn.cs

示例4: FixedCamera2D

 /// <summary>
 /// Initializes a new instance of the <see cref="FixedCamera2D" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="position">The camera position</param>
 public FixedCamera2D(string name, Vector2 position)
 {
     this.entity = new Entity(name)
     .AddComponent(new Camera2D()
     {
         Position = position.ToVector3(0),                
     });
 }
开发者ID:huodianyan,项目名称:Components,代码行数:13,代码来源:FixedCamera2D.cs

示例5: GetCollision

 /// <summary>
 ///     Returns Collision List
 /// </summary>
 /// <param name="fromVector2">
 ///     From Vector3 Source
 /// </param>
 /// <param name="to">
 ///     To Vector3 Source
 /// </param>
 /// <param name="delayOverride">
 ///     Delay Override
 /// </param>
 /// <returns>
 ///     Collision List
 /// </returns>
 public List<Obj_AI_Base> GetCollision(Vector2 fromVector2, List<Vector2> to, float delayOverride = -1)
 {
     return SDK.Collision.GetCollision(
         to.Select(h => h.ToVector3()).ToList(),
         new PredictionInput
         {
             From = fromVector2.ToVector3(),
             Type = this.Type,
             Radius = this.Width,
             Delay = delayOverride > 0 ? delayOverride : this.Delay,
             Speed = this.Speed
         });
 }
开发者ID:CONANLXF,项目名称:Berb.Common,代码行数:28,代码来源:Spell.cs

示例6: IsOrthogonal

 /// <summary>
 ///     Returns if the angle is orthogonal.
 /// </summary>
 /// <param name="vector2">Extended SharpDX Vector2</param>
 /// <param name="toVector2">SharpDX Vector2</param>
 /// <returns>The <see cref="bool" />.</returns>
 public static bool IsOrthogonal(this Vector2 vector2, Vector2 toVector2)
 {
     return IsOrthogonal(vector2, toVector2.ToVector3());
 }
开发者ID:8569482,项目名称:LeagueSharp.SDK,代码行数:10,代码来源:Vector2Extensions.cs

示例7: IsInRange

 /// <summary>
 ///     Returns if the position is in the range of the Item.
 /// </summary>
 /// <param name="position">
 ///     Position to be checked.
 /// </param>
 /// <returns>
 ///     The <see cref="bool" />
 /// </returns>
 public bool IsInRange(Vector2 position)
 {
     return this.IsInRange(position.ToVector3());
 }
开发者ID:Gilbertobal,项目名称:LeagueSharp.SDK,代码行数:13,代码来源:Items.cs

示例8: DaggerUltForceStaffCombo

        private static void DaggerUltForceStaffCombo(Hero me, Ability r, bool hasForceStaffForUse,
            Vector2 bestPointToPort)
        {
            var bestEnemy = ObjectMgr.GetEntities<Hero>().Where
                    (x => x.Team != me.Team && x.IsValid && x.Distance2D(bestPointToPort.ToVector3()) <=
                                                    r.CastRange).OrderBy(x => x.Health).FirstOrDefault();

            #region blink dagger -> ultimate -> force staff
            if (bestEnemy != null)
            {
                MyItems.BlinkDagger.TheItem.UseAbility(bestPointToPort.ToVector3());

                Vector3 lastPosBeforeCastingUltimate = bestPointToPort.ToVector3();

                DelayHandler.Add(delegate
                {
                    r.UseAbility(bestEnemy);
                }, stdCastDelay, DelayHandler.Descriptions.Ultimate);
                DelayHandler.UltimateInAutomaticUse = true;

                DelayHandler.Add(delegate
                {
                    //me.Move(lastPosBeforeCastingUltimate);
                    DelayHandler.MoveSpammer.Involke(lastPosBeforeCastingUltimate, stdCastDelay * 2);

                }, stdCastDelay + 250, DelayHandler.Descriptions.Move);

                /*ultimate -> force staff or blink dagger*/
                if (hasForceStaffForUse)
                {
                    DelayHandler.Add(delegate
                    {
                        MyItems.ForceStaff.TheItem.UseAbility(me);
                    }, stdCastDelay + 250 + stdCastDelay * 2, DelayHandler.Descriptions.ForceStaffCast);
                }
                #endregion blink dagger -> ultimate -> force staff
            }
            else
            {
                CheckUltimateOffensiveWith_TP_Zepter(2, me, r);
            }
        }
开发者ID:DanThePman,项目名称:VengeFun,代码行数:42,代码来源:Ultimate.cs

示例9: DrawLine

        private static ParticleEffect DrawLine(Vector2 position, float size, int horizontal = 0, int vertical = 0) {
            var position3 = position.ToVector3();
            var effect = new ParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf", position3);

            effect.SetControlPoint(1, new Vector3(
                Program.GetMenuValue("red"),
                Program.GetMenuValue("green"),
                Program.GetMenuValue("blue")));

            effect.SetControlPoint(2, new Vector3(size, 255, 0));

            effect.SetControlPointOrientation(4, new Vector3(horizontal, 0, 0), new Vector3(vertical, 0, 0),
                new Vector3(0, 0, 0));

            return effect;
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:16,代码来源:SpawnBoxes.cs

示例10: GetTileCoordinatesByWorldPosition

        /// <summary>
        /// Get Tile coordinates (x, y) by world position
        /// </summary>
        /// <param name="position">The world position</param>
        /// <param name="tileX">Out tile X coordinate</param>
        /// <param name="tileY">Out tile Y coordinate</param>
        public void GetTileCoordinatesByWorldPosition(Vector2 position, out int tileX, out int tileY)
        {
            int sideLengthX = 0;
            int sideLengthY = 0;
            bool staggerX = this.StaggerAxis == TiledMapStaggerAxisType.X;
            bool staggerEven = this.StaggerIndex == TiledMapStaggerIndexType.Even;

            if (this.Orientation == TiledMapOrientationType.Hexagonal)
            {
                if (this.StaggerAxis == TiledMapStaggerAxisType.X)
                {
                    sideLengthX = this.HexSideLength;
                }
                else
                {
                    sideLengthY = this.HexSideLength;
                }
            }

            position = Vector3.Transform(position.ToVector3(this.transform.DrawOrder), this.transform.WorldInverseTransform).ToVector2();

            Vector2 referencePosition = new Vector2(
                position.X / (this.TileWidth + sideLengthX),
                position.Y / (this.TileHeight + sideLengthY));

            if (referencePosition.X < 0)
            {
                referencePosition.X -= 1;
            }

            if (referencePosition.Y < 0)
            {
                referencePosition.Y -= 1;
            }

            switch (this.Orientation)
            {
                case TiledMapOrientationType.Orthogonal:
                    tileX = (int)referencePosition.X;
                    tileY = (int)referencePosition.Y;
                    break;

                case TiledMapOrientationType.Isometric:
                    float halfHeight = this.Height * 0.5f;
                    tileX = (int)(-halfHeight + (referencePosition.X + referencePosition.Y));

                    float y = halfHeight + (-referencePosition.X + referencePosition.Y);
                    y = (y >= 0) ? y : y - 1;
                    tileY = (int)y;
                    break;

                case TiledMapOrientationType.Staggered:

                    if (staggerEven)
                    {
                        if (staggerX)
                        {
                            referencePosition.Y -= 0.5f;
                        }
                        else
                        {
                            referencePosition.X -= 0.5f;
                        }
                    }

                    int coordX = (int)(-0.5f + (referencePosition.X + referencePosition.Y));

                    y = 0.5f + (-referencePosition.X + referencePosition.Y);
                    y = (y >= 0) ? y : y - 1;
                    int coordY = (int)y;

                    int evenOffset = staggerEven ? 1 : 0;

                    if (staggerX)
                    {
                        tileX = coordX - coordY;
                        tileY = (coordX + coordY + evenOffset) / 2;
                    }
                    else
                    {
                        tileX = (coordX - coordY + evenOffset) / 2;
                        tileY = coordX + coordY;
                    }
                    break;

                case TiledMapOrientationType.Hexagonal:
                    Vector2 tileCoordinates = Vector2.Zero;
                    var sideOffsetX = (this.TileWidth - sideLengthX) / 2;
                    var sideOffsetY = (this.TileHeight - sideLengthY) / 2;

                    if (staggerX)
                    {
                        position.X -= staggerEven ? this.TileWidth : sideOffsetX;
                    }
//.........这里部分代码省略.........
开发者ID:WaveEngine,项目名称:Extensions,代码行数:101,代码来源:TiledMap.cs

示例11: ComboInAction

        private static void ComboInAction(Hero me, Hero target)
        {
            
            if (!Utils.SleepCheck("nextAction")) return;
            var dist = me.Distance2D(target);
            switch (_stage)
            {
                case 0:
                    if (target.Modifiers.Any(x => x.Name == "modifier_earth_spirit_magnetize") && !CanCastCombo()) { _stage = 5; }
                    if (Menu.Item("dagger").GetValue<StringList>().SelectedIndex == (int)DaggerStage.OnStartCombo)
                    {
                        var blink = me.FindItem("item_blink");
                        if (dist >= Pull.CastRange && blink != null && blink.CanBeCasted())
                        {
                            if (dist >= Pull.CastRange + 1100)
                            {
                                me.Move(target.Position);
                                Utils.Sleep(200, "nextAction");
                                break;
                            }
                            var ang = me.FindAngleBetween(target.Position, true);
                            var p = new Vector2((float)(me.Position.X + 1100 * Math.Cos(ang)), (float)(me.Position.Y + 1100 * Math.Sin(ang)));
                            blink.UseAbility(p.ToVector3(true));
                            Utils.Sleep(100, "nextAction");
                            break;
                        }
                    }
                    if (AnyStoneNear(me) && dist <= 1900)
                    {
                        if (Menu.Item("debug").GetValue<bool>()) PrintInfo("stone near you finded");
                        _stage++;
                        break;
                    }
                    if (Remnant.CanBeCasted())
                    {
                        if (dist <= 1900)
                        {
                            if (me.NetworkActivity == NetworkActivity.Move)
                                me.Stop();
                            Remnant.UseAbility(Prediction.InFront(me, 100));
                            Utils.Sleep(50 + Remnant.FindCastPoint(), "nextAction");
                            _stage++;
                            if (Menu.Item("debug").GetValue<bool>()) PrintInfo("remnant create");
                        }
                        else
                        {
                            me.Move(target.Position);
                            Utils.Sleep(50 + Remnant.FindCastPoint(), "nextAction");
                        }

                    }
                    break;
                case 1:
                    if (Push.CanBeCasted())
                    {
                        var last = GetLastRemnant(me);

                        if (last != null)
                        {
                            if (Menu.Item("debug").GetValue<bool>()) PrintInfo("push casted");
                            Push.UseAbility(target.Position);
                            Utils.Sleep(100 + Push.FindCastPoint(), "nextAction");
                        }
                    }
                    else
                        _stage++;
                    break;
                case 2:
                    if (Pull.CanBeCasted())
                    {
                        var last = GetLastRemnant(me);
                        if (last != null)
                        {
                            if (target.Distance2D(last) <= 400)
                            {
                                if (me.Distance2D(target) <= Pull.CastRange)
                                {
                                    /*var pos =
                                        new Vector3(
                                            (float)
                                                (last.Position.X +
                                                 (1200*Game.Ping/1000+30)*
                                                 Math.Cos(me.FindAngleBetween(last.Position))),
                                            (float)
                                                (last.Position.Y +
                                                 (1200*Game.Ping/1000+30)*
                                                 Math.Sin(me.FindAngleBetween(last.Position))), 0);
                                    */
                                    Pull.UseAbility(Prediction.InFront(me, (float) (me.Distance2D(last) + (1200 * 0.1 + Game.Ping / 1000))));
                                    
                                    if (Menu.Item("debug").GetValue<bool>())
                                    {
                                        Game.PrintMessage((1200*0.1 + Game.Ping / 1000).ToString(), MessageType.ChatMessage);
                                        //globalPos = pos;
                                        PrintInfo("last pos: " + last.Position.X);
                                        PrintInfo("pull casted. Distance: " + target.Distance2D(last));
                                    }
                                    //Utils.Sleep(Game.Ping + Pull.FindCastPoint(), "nextAction");

                                }
//.........这里部分代码省略.........
开发者ID:dendimonster,项目名称:EnsageSharp-1,代码行数:101,代码来源:Program.cs

示例12: LetAghanimCombo

        private static void LetAghanimCombo(Hero me,Hero target)
        {
            if (!Utils.SleepCheck("nextAction")) return;
            var ability = me.FindSpell("earth_spirit_petrify");
            if (ability==null) return;
            if (ability.Level==0) return;

            var inStone = target.Modifiers.Any(x=>x.Name=="modifier_earthspirit_petrify");

            var dist = me.Distance2D(target);
            if (ability.CanBeCasted() && !inStone)
            {
                if (Menu.Item("dagger").GetValue<StringList>().SelectedIndex == (int)DaggerStage.OnStartCombo || Menu.Item("dagger").GetValue<StringList>().SelectedIndex == (int)DaggerStage.AfterSmash)
                {
                    var blink = me.FindItem("item_blink");
                    if (dist >= ability.CastRange && blink!=null && blink.CanBeCasted())
                    {
                        var ang = me.FindAngleBetween(target.Position, true);
                        var p = new Vector2((float)(target.Position.X - 100 * Math.Cos(ang)), (float)(target.Position.Y - 100 * Math.Sin(ang)));
                        blink.UseAbility(p.ToVector3(true));
                    }
                }
                ability.UseAbility(target);
                Utils.Sleep(150 + ability.FindCastPoint(), "nextAction");
                return;
            }
            if (Pull != null && Pull.CanBeCasted() && inStone)
            {
                Pull.UseAbility(target.Position);
                //PrintInfo(Roll.CastSkillShot(target).ToString());
                Utils.Sleep(300 + Pull.FindCastPoint(), "nextAction");
                return;
            }
            if (Push != null && Push.CanBeCasted() && inStone && dist<=150)
            {
                Push.UseAbility(Game.MousePosition);
                if (Roll != null && Roll.CanBeCasted())
                {
                    if (Remnant != null && Remnant.CanBeCasted())
                    {
                        var ang = me.FindAngleBetween(Game.MousePosition, true);
                        var p = new Vector2((float) (me.Position.X + 100 * Math.Cos(ang)), (float) (me.Position.Y + 100 * Math.Sin(ang)));
                        Remnant.UseAbility(p.ToVector3(true));
                    }
                    Roll.UseAbility(Game.MousePosition,true);
                }
                Utils.Sleep(300 + Push.FindCastPoint(), "nextAction");
            }
        }
开发者ID:dendimonster,项目名称:EnsageSharp-1,代码行数:49,代码来源:Program.cs

示例13: LetsPush

 private static void LetsPush()
 {
     var me = ObjectMgr.LocalHero;
     if (!Push.CanBeCasted() || !Utils.SleepCheck("preComboW8")) return;
     if (AnyStoneNear(me,new Vector3(),200F))
     {
         
     }
     else if (Remnant.CanBeCasted())
     {
         var ang = me.FindAngleBetween(Game.MousePosition, true);
         var p = new Vector2((float)(me.Position.X + 50 * Math.Cos(ang)), (float)(me.Position.Y + 50 * Math.Sin(ang)));
         Remnant.UseAbility(p.ToVector3(true));
     }
     else
     {
         return;
     }
     var pos = Game.MousePosition;
     if (AnyStoneNear(me, pos))
     {
         var ang = me.FindAngleBetween(pos, true);
         pos = new Vector2((float)(pos.X + 300 * Math.Cos(ang)), (float)(pos.Y + 300 * Math.Sin(ang))).ToVector3(true);
     }
     Push.UseAbility(pos);
     Utils.Sleep(500, "preComboW8");
 }
开发者ID:dendimonster,项目名称:EnsageSharp-1,代码行数:27,代码来源:Program.cs

示例14: LetsRoll

        private static void LetsRoll()
        {
            if (!Roll.CanBeCasted() || !Utils.SleepCheck("preComboW8")) return;
            var me = ObjectMgr.LocalHero;
            if (AnyStoneNear(me))
            {

            }
            else if (Remnant.CanBeCasted())
            {
                var ang = me.FindAngleBetween(Game.MousePosition, true);
                var p = new Vector2((float)(me.Position.X + 200 * Math.Cos(ang)), (float)(me.Position.Y + 100 * Math.Sin(ang)));
                Remnant.UseAbility(p.ToVector3(true));
            }
            else
            {
                return;
            }
            Roll.UseAbility(Game.MousePosition);
            Utils.Sleep(500, "preComboW8");
        }
开发者ID:dendimonster,项目名称:EnsageSharp-1,代码行数:21,代码来源:Program.cs

示例15: DistanceSquared

 /// <summary>
 ///     Calculates the squared distance between two vectors.
 /// </summary>
 /// <param name="vector3">Extended SharpDX Vector3</param>
 /// <param name="toVector2">SharpDX Vector2</param>
 /// <returns>The squared distance between the two vectors.</returns>
 public static float DistanceSquared(this Vector3 vector3, Vector2 toVector2)
 {
     return Vector3.DistanceSquared(vector3, toVector2.ToVector3());
 }
开发者ID:MarkHC,项目名称:Ensage.Common,代码行数:10,代码来源:Vector3Extensions.cs


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