當前位置: 首頁>>代碼示例>>C#>>正文


C# WorldObject.IsInFrontOf方法代碼示例

本文整理匯總了C#中WCell.RealmServer.Entities.WorldObject.IsInFrontOf方法的典型用法代碼示例。如果您正苦於以下問題:C# WorldObject.IsInFrontOf方法的具體用法?C# WorldObject.IsInFrontOf怎麽用?C# WorldObject.IsInFrontOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WCell.RealmServer.Entities.WorldObject的用法示例。


在下文中一共展示了WorldObject.IsInFrontOf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IsInFrontOfCaster

		public static void IsInFrontOfCaster(SpellEffectHandler effectHandler, WorldObject target, ref SpellFailedReason failedReason, TargetFilter filter)
		{
			var caster = effectHandler.Cast.CasterObject;
			if (caster.IsPlayer && !target.IsInFrontOf(caster))
			{
				failedReason = SpellFailedReason.NotInfront;
			}
			else
			{
				filter(effectHandler, target, ref failedReason);
			}
		}
開發者ID:KroneckerX,項目名稱:WCell,代碼行數:12,代碼來源:DefaultTargetFilters.cs

示例2: CheckPlayerCast

		/// <summary>
		/// Checks the current Cast when Players are using it
		/// </summary>
		protected SpellFailedReason CheckPlayerCast(WorldObject selected)
		{
			var caster = (Character)CasterUnit;
			if (Spell.TargetFlags != 0 && !IsAoE && selected == caster)
			{
				// Caster is selected by default
				return SpellFailedReason.NoValidTargets;
			}

			// target specific settings			
			if (!IsAoE && caster != selected && selected != null)
			{
				// Target must be selected and in front of us
				if (caster.IsPlayer && !selected.IsInFrontOf(caster))
				{
					// NPCs always face the Target
					return SpellFailedReason.UnitNotInfront;
				}

				if (Spell.HasHarmfulEffects && selected is Unit)
				{
					if (((Unit)selected).IsEvading || ((Unit)selected).IsInvulnerable)
					{
						return SpellFailedReason.TargetAurastate;
					}
				}
				//else if (Caster is Unit && !Caster.IsInFrontOfThis(TargetLoc))				
				//{				
				//    ((Unit)Caster).Face(TargetLoc);				
				//}			
			}
			// we can't cast if we are dead
			else if (!caster.IsAlive)
			{
				return SpellFailedReason.CasterDead;
			}

			var err = Spell.CheckCasterConstraints(caster);
			if (err != SpellFailedReason.Ok)
			{
				return err;
			}

			// cancel looting
			caster.CancelLooting();

			// check required skill
			if (Spell.Ability != null && Spell.Ability.RedValue > 0 &&
				caster.Skills.GetValue(Spell.Ability.Skill.Id) < Spell.Ability.RedValue)
			{
				return SpellFailedReason.MinSkill;
			}

			// Taming needs some extra checks
			if (Spell.IsTame)
			{
				var target = selected as NPC;
				if (target == null)
				{
					return SpellFailedReason.BadTargets;
				}

				if (target.CurrentTamer != null)
				{
					return SpellFailedReason.AlreadyBeingTamed;
				}

				if (CheckTame(caster, target) != TameFailReason.Ok)
				{
					return SpellFailedReason.DontReport;
				}
			}

			if (!caster.HasEnoughPowerToCast(Spell, null) ||
				(UsesRunes && !caster.PlayerSpells.Runes.HasEnoughRunes(Spell)))
			{
				return SpellFailedReason.NoPower;
			}

			// Item restrictions			
			return Spell.CheckItemRestrictions(TargetItem, caster.Inventory);
		}
開發者ID:primax,項目名稱:WCell,代碼行數:85,代碼來源:SpellCast.cs


注:本文中的WCell.RealmServer.Entities.WorldObject.IsInFrontOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。