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


C# Target.Invoke方法代碼示例

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


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

示例1: ProcessTarget

		private void ProcessTarget( Target targ )
		{
			bool isDispel = ( targ is DispelSpell.InternalTarget );
			bool isParalyze = ( targ is ParalyzeSpell.InternalTarget );
			bool isTeleport = ( targ is TeleportSpell.InternalTarget );
			bool teleportAway = false;

			Mobile toTarget;

			if ( isDispel )
			{
				toTarget = FindDispelTarget( false );

				if ( !SmartAI && toTarget != null )
					RunTo( toTarget );
				else if ( toTarget != null && m_Mobile.InRange( toTarget, 10 ) )
					RunFrom( toTarget );
			}
			else if ( SmartAI && (isParalyze || isTeleport) )
			{
				toTarget = FindDispelTarget( true );

				if ( toTarget == null )
				{
					toTarget = m_Mobile.Combatant;

					if ( toTarget != null )
						RunTo( toTarget );
				}
				else if ( m_Mobile.InRange( toTarget, 10 ) )
				{
					RunFrom( toTarget );
					teleportAway = true;
				}
				else
				{
					teleportAway = true;
				}
			}
			else
			{
				toTarget = m_Mobile.Combatant;

				if ( toTarget != null )
					RunTo( toTarget );
			}

			if ( (targ.Flags & TargetFlags.Harmful) != 0 && toTarget != null )
			{
				if ( (targ.Range == -1 || m_Mobile.InRange( toTarget, targ.Range )) && m_Mobile.CanSee( toTarget ) && m_Mobile.InLOS( toTarget ) )
				{
					targ.Invoke( m_Mobile, toTarget );
				}
				else if ( isDispel )
				{
					targ.Cancel( m_Mobile, TargetCancelType.Canceled );
				}
			}
			else if ( (targ.Flags & TargetFlags.Beneficial) != 0 )
			{
				targ.Invoke( m_Mobile, m_Mobile );
			}
			else if ( isTeleport && toTarget != null )
			{
				Map map = m_Mobile.Map;

				if ( map == null )
				{
					targ.Cancel( m_Mobile, TargetCancelType.Canceled );
					return;
				}

				int px, py;

				if ( teleportAway )
				{
					int rx = m_Mobile.X - toTarget.X;
					int ry = m_Mobile.Y - toTarget.Y;

					double d = m_Mobile.GetDistanceToSqrt( toTarget );

					px = toTarget.X + (int)(rx * (10 / d));
					py = toTarget.Y + (int)(ry * (10 / d));
				}
				else
				{
					px = toTarget.X;
					py = toTarget.Y;
				}

				for ( int i = 0; i < m_Offsets.Length; i += 2 )
				{
					int x = m_Offsets[i], y = m_Offsets[i + 1];

					Point3D p = new Point3D( px + x, py + y, 0 );

					LandTarget lt = new LandTarget( p, map );

					if ( (targ.Range == -1 || m_Mobile.InRange( p, targ.Range )) && m_Mobile.InLOS( lt ) && map.CanSpawnMobile( px + x, py + y, lt.Z ) && !SpellHelper.CheckMulti( p, map ) )
					{
//.........這裏部分代碼省略.........
開發者ID:ITLongwell,項目名稱:aedilis2server,代碼行數:101,代碼來源:VampireAI.cs

示例2: ProcessTarget

        private void ProcessTarget( Target targ, NeedDelegate[] func )
        {
            Mobile toHelp = Find( func );

            if ( toHelp != null )
            {
                if ( targ.Range != -1 && !m_Mobile.InRange( toHelp, targ.Range ) )
                {
                    DoMove( m_Mobile.GetDirectionTo( toHelp ) | Direction.Running );
                }
                else
                {
                    targ.Invoke( m_Mobile, toHelp );
                }
            }
            else
            {
                targ.Cancel( m_Mobile, TargetCancelType.Canceled );
            }
        }
開發者ID:Ravenwolfe,項目名稱:xrunuo,代碼行數:20,代碼來源:HealerAI.cs

示例3: ProcessTarget

        private void ProcessTarget( Target targ )
        {
            bool isDispel = ( targ is DispelSpell.InternalTarget );
            bool isParalyze = ( targ is ParalyzeSpell.InternalTarget );

            Mobile toTarget;

            if ( isDispel )
            {
                toTarget = FindDispelTarget( false );

                if ( !SmartAI && toTarget != null )
                    RunTo( toTarget );
                else if ( toTarget != null && m_Mobile.InRange( toTarget, 8 ) )
                    RunFrom( toTarget );
            }
            else if ( SmartAI && isParalyze )
            {
                toTarget = FindDispelTarget( true );

                if ( toTarget == null )
                {
                    toTarget = m_Mobile.Combatant;

                    if ( toTarget != null )
                        RunTo( toTarget );
                }
            }
            else
            {
                toTarget = m_Mobile.Combatant;

                if ( toTarget != null )
                    RunTo( toTarget );
            }

            if ( (targ.Flags & TargetFlags.Harmful) != 0 && toTarget != null )
            {
                if ( (targ.Range == -1 || m_Mobile.InRange( toTarget, targ.Range )) && m_Mobile.CanSee( toTarget ) && m_Mobile.InLOS( toTarget ) )
                {
                    targ.Invoke( m_Mobile, toTarget );
                }
                else if ( isDispel )
                {
                    targ.Cancel( m_Mobile, TargetCancelType.Canceled );
                }
            }
            else if ( (targ.Flags & TargetFlags.Beneficial) != 0 )
            {
                targ.Invoke( m_Mobile, m_Mobile );
            }
            else
            {
                targ.Cancel( m_Mobile, TargetCancelType.Canceled );
            }
        }
開發者ID:greeduomacro,項目名稱:divinity,代碼行數:56,代碼來源:MageAI.cs

示例4: ProcessTarget

		private void ProcessTarget( Target targ )
		{
			targ.Invoke( m_Mobile, m_Mobile );
		}
開發者ID:Crome696,項目名稱:ServUO,代碼行數:4,代碼來源:PaladinAI.cs

示例5: ProcessTarget

		public override void ProcessTarget(Target targ)
		{
			bool isDispel = (targ is DispelSpell.InternalTarget);
			bool isParalyze = (targ is ParalyzeSpell.InternalTarget);
			bool isTeleport = (targ is TeleportSpell.InternalTarget);
			bool isCrossHeal = (targ is GreaterHealSpell.InternalTarget);
			bool isTrap = (targ is MagicTrapSpell.InternalTarget);
			bool teleportAway = false;
			bool isReveal = (targ is RevealSpell.InternalTarget || targ is DetectHidden.InternalTarget);

			Mobile toTarget = null;
			Mobile toHeal = null;

			if (isReveal)
			{
				targ.Invoke(m_Mobile, m_Mobile);
			}

			if (isTrap)
			{
				Pouch p = FindPouch(m_Mobile);
				if (p != null)
				{
					targ.Invoke(m_Mobile, p);
				}
				else
					targ.Cancel(m_Mobile, TargetCancelType.Canceled);
			}

			if (isDispel)
			{
				toTarget = FindDispelTarget(false);

				if (toTarget != null && m_Mobile.InRange(toTarget, 10) && !toTarget.Paralyzed)
					RunFrom(toTarget);
			}

			if (CrossHeals && isCrossHeal)
			{
				toHeal = FindHealTarget(true);

				if (toHeal != null && !m_Mobile.InRange(toHeal, 8))
				{

					RunTo(toHeal, CanRun);
				}
			}

			else if (isParalyze || isTeleport)
			{
				toTarget = FindDispelTarget(true);

				if (toTarget == null)
				{
					toTarget = m_Mobile.Combatant;

					if (toTarget != null && !m_Mobile.InRange(toTarget, 8))
						RunTo(toTarget, CanRun);
				}
				else if (m_Mobile.InRange(toTarget, 10))
				{
					RunFrom(toTarget);
					teleportAway = true;
				}
				else
				{
					teleportAway = true;
				}
			}

			else
			{
				if (m_Mobile.ControlOrder == OrderType.Come && isTeleport)
				{
					toTarget = m_Mobile.ControlMaster;
				}
				else
				{
					toTarget = m_Mobile.Combatant;
				}

				if (toTarget != null)
				{

					RunTo(toTarget, CanRun);
				}
			}

			if ((targ.Flags & TargetFlags.Harmful) != 0 && toTarget != null)
			{
				if ((m_Mobile.InRange(toTarget, 10)) && m_Mobile.CanSee(toTarget) && m_Mobile.InLOS(toTarget))
				{
					targ.Invoke(m_Mobile, toTarget);
				}
				else if (isDispel)
				{
					targ.Cancel(m_Mobile, TargetCancelType.Canceled);
				}

			}
//.........這裏部分代碼省略.........
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:101,代碼來源:BaseHybridAI.cs


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