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


C# Vector3.IsGround方法代码示例

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


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

示例1: MoveTo

        public static async Task<bool> MoveTo(Vector3 destination, bool useMesh = true, uint mountId = 0, float radius = 2.0f, string name = null, Func<float, float, bool> stopCallback = null, bool dismountAtDestination = false)
        {
            // ReSharper disable once InconsistentNaming
            var distance3d = Core.Player.Location.Distance3D(destination);

            if (Actionmanager.CanMount == 0 && ((!Core.Player.IsMounted && distance3d >= CharacterSettings.Instance.MountDistance && CharacterSettings.Instance.UseMount) || !destination.IsGround()))
            {
                var ticks = 0;
                while (!Core.Player.IsMounted && ticks++ < 10 && ShouldContinue)
                {
                    if (mountId > 0)
                    {
                        if (!await CommonTasks.MountUp(mountId))
                        {
                            if (!await CommonTasks.MountUp(1))
                            {
                                await CommonTasks.MountUp(45);
                            }
                        }
                    }
                    else
                    {
                        await CommonTasks.MountUp();
                    }

                    await Coroutine.Yield();
                }
            }

            await MoveToNoMount(destination, useMesh, radius, name, stopCallback);

            var dismountTicks = 0;
            while (dismountAtDestination && dismountTicks++ < 10 && Core.Player.IsMounted && ShouldContinue)
            {
                if (MovementManager.IsFlying)
                {
                    if (Navigator.PlayerMover is FlightEnabledSlideMover)
                    {
                        Navigator.Stop();
                    }
                    else
                    {
                        MovementManager.StartDescending();
                    }
                }
                else
                {
                    Actionmanager.Dismount();
                }

                await Coroutine.Wait(1000, () => !Core.Player.IsMounted);
            }

            if (dismountTicks >= 10)
            {
                Logging.Write(Colors.Red, "Failed to dismount after MoveTo task.");
                return false;
            }

            return true;
        }
开发者ID:juliankoehn,项目名称:ExBuddy,代码行数:61,代码来源:Behaviors.cs

示例2: MoveTo

		public static async Task<bool> MoveTo(
			Vector3 destination,
			bool useMesh = true,
			uint mountId = 0,
			float radius = 2.0f,
			string name = null,
			Func<float, float, bool> stopCallback = null,
			bool dismountAtDestination = false)
		{
			// ReSharper disable once InconsistentNaming
			var distance3d = Core.Player.Location.Distance3D(destination);

			if (Actionmanager.CanMount == 0
				&& ((!Core.Player.IsMounted && distance3d >= CharacterSettings.Instance.MountDistance
					&& CharacterSettings.Instance.UseMount) || !destination.IsGround()))
			{
				uint flightSpecificMountId = 0;
				if (mountId == 0)
				{
					mountId = CharacterSettings.Instance.MountId;
					if (mountId == uint.MaxValue)
					{
						var mount = Actionmanager.AvailableMounts.Shuffle().FirstOrDefault();
						if (mount != null)
						{
							mountId = mount.Id;
						}
					}
					var playerMover = Navigator.PlayerMover as IFlightEnabledPlayerMover;
					if (playerMover != null)
					{
						flightSpecificMountId = (uint)playerMover.FlightMovementArgs.MountId;
					}
				}

				var ticks = 0;
				while (!Core.Player.IsMounted && ticks++ < 10 && ShouldContinue)
				{
					if (WorldManager.CanFly && flightSpecificMountId > 0)
					{
						await CommonTasks.MountUp(flightSpecificMountId);
						await Coroutine.Yield();
						if (Core.Player.IsMounted)
						{
							break;
						}
					}

					if (mountId > 0)
					{
						if (!await CommonTasks.MountUp(mountId))
						{
							if (!await CommonTasks.MountUp(1))
							{
								await CommonTasks.MountUp(45);
							}
						}
					}
					else
					{
						await CommonTasks.MountUp();
					}

					await Coroutine.Yield();
				}
			}

			await MoveToNoMount(destination, useMesh, radius, name, stopCallback);

			var dismountTicks = 0;
			while (dismountAtDestination && dismountTicks++ < 100 && Core.Player.IsMounted && ShouldContinue)
			{
				if (MovementManager.IsFlying)
				{
					if (Navigator.PlayerMover is FlightEnabledSlideMover)
					{
						Navigator.Stop();
					}
					else
					{
						MovementManager.StartDescending();
					}
				}
				else
				{
					Actionmanager.Dismount();
				}

				await Coroutine.Wait(100, () => !Core.Player.IsMounted);
			}

			if (dismountTicks > 100)
			{
				Logger.Instance.Error("Failed to dismount after MoveTo task.");
				return false;
			}

			return true;
		}
开发者ID:Junified,项目名称:ExBuddy,代码行数:99,代码来源:Behaviors.cs

示例3: ShouldFlyInternal

		internal static bool ShouldFlyInternal(Vector3 destination)
		{
			return MovementManager.IsFlying
			       || (Actionmanager.CanMount == 0
			           &&
			           ((destination.Distance3D(GameObjectManager.LocalPlayer.Location) >=
			             CharacterSettings.Instance.MountDistance)
			            || !destination.IsGround()));
		}
开发者ID:MGramolini,项目名称:ExBuddy,代码行数:9,代码来源:FlightEnabledSlideMover.cs


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