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


C# Vector3.IsOnScreen方法代码示例

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


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

示例1: GetScreenPosition

        public static PositionInfo GetScreenPosition(Vector3 position3D)
        {
            var position = position3D.To2D();

            var worldCenter = GetWorldCenter();
            var screenCenter = Drawing.WorldToScreen(worldCenter.To3D().SetZ(0));

            if (position3D.IsOnScreen())
            {
                var screenPosition = Drawing.WorldToScreen(position3D);

                return new PositionInfo
                {
                screenPosition = screenPosition,
                direction = (screenPosition - screenCenter).Normalized(),
                distance = worldCenter.Distance(position),
                screenCollisionDistance = worldCenter.Distance(position)
                };
            }

            var worldDir = (position - worldCenter).Normalized();
            var worldClosePosition = worldCenter + worldDir * 100;

            var screenClosePosition = Drawing.WorldToScreen(worldClosePosition.To3D().SetZ(0));

            var dir = (screenClosePosition - screenCenter).Normalized();
            var screenFarPosition = screenCenter + dir * (Math.Max(Drawing.Width, Drawing.Height) + 100);

            var ray = new Ray(screenFarPosition.To3D().SetZ(0), -dir.To3D().SetZ(0));

            var boundingBox = new BoundingBox(new Vector3(0, 0, -1),
                new Vector3(Drawing.Width, Drawing.Height, 1));

            float dist;
            var hasIntersection = ray.Intersects(ref boundingBox, out dist);

            if (hasIntersection)
            {
                var rayDirection = dir;
                var distance = worldCenter.Distance(position);
                var finalScreenPos = screenFarPosition - dir * (dist);

                return new PositionInfo
                {
                    screenPosition = position3D.IsOnScreen() ?
                            Drawing.WorldToScreen(position3D) : finalScreenPos,
                    direction = rayDirection,
                    distance = distance,
                    screenCollisionDistance = dist
                };
            }

            //Console.WriteLine("no intersect");

            return null;
        }
开发者ID:654955321,项目名称:HY_Recommend,代码行数:56,代码来源:ExtendedAwareness.cs

示例2: Camp

            public Camp(string name,
                float spawnTime,
                int respawnTimer,
                Vector3 position,
                List<Mob> mobs,
                Utility.Map.MapType mapType,
                GameObjectTeam team,
                Color colour,
                Timers timer,
                bool isRanged = false,
                int state = 0,
                int respawnTime = 0,
                int lastChangeOnState = 0,
                bool shouldping = true,
                int lastPing = 0)
            {
                Name = name;
                SpawnTime = spawnTime;
                RespawnTimer = respawnTimer;
                Position = position;
                MapPosition = Drawing.WorldToScreen(Position);
                MinimapPosition = Drawing.WorldToMinimap(Position);
                Mobs = mobs;
                MapType = mapType;
                Team = team;
                Colour = colour;
                IsRanged = isRanged;
                State = state;
                RespawnTime = respawnTime;
                LastChangeOnState = lastChangeOnState;
                Timer = timer;
                ShouldPing = shouldping;
                LastPing = lastPing;

                #region Load Text

                TextMinimap = new Render.Text(0, 0, "", Program._menu.Item("timerfontminimap").GetValue<Slider>().Value, Program.White)
                {
                    VisibleCondition =
                        sender =>
                            Program.Timeronminimap && RespawnTime > Environment.TickCount && State == 7,
                    PositionUpdate = delegate
                    {
                        Vector2 v2 = Timer.MinimapPosition;
                        return v2;
                    },
                    TextUpdate = () => Timer.TextOnMinimap,
                    OutLined = false,
                    Centered = true
                };
                TextMinimap.Add();

                TextMap = new Render.Text(0, 0, "", Program._menu.Item("timerfontmap").GetValue<Slider>().Value, Program.White)
                {
                    VisibleCondition =
                        sender =>
                            Program.Timeronmap && RespawnTime > Environment.TickCount && State == 7 && Position.IsOnScreen(),
                    PositionUpdate = delegate
                    {
                        Vector2 v2 = Timer.Position;
                        return v2;
                    },
                    TextUpdate = () => Timer.TextOnMap,
                    OutLined = false,
                    Centered = true
                };
                TextMap.Add();

                #endregion

                //Drawing.OnEndScene += Drawing_OnEndScene;
            }
开发者ID:Backup521,项目名称:Orbwalker,代码行数:72,代码来源:Jungle.cs

示例3: IsOnScreen

 private bool IsOnScreen(Vector3 position)
 {
     if (position.IsOnScreen())
     {
         return true;
     }
     if (!(Game.CursorPos.Distance(position) > 250f))
     {
         return true;
     }
     return (Drawing.WorldToScreen(Game.CursorPos).Distance(Utils.GetCursorPos()) <= 100f);
 }
开发者ID:aikoy,项目名称:LeagueSharp-Dev,代码行数:12,代码来源:SFXHumanizerPro.cs


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