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


C# BaseAI.DoMove方法代碼示例

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


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

示例1: OnTarget

        protected override void OnTarget( Mobile from, object target )
        {
            if( target is BaseCreature )
            {
                BaseCreature pet = (BaseCreature)target;
                m_ai = pet.AIObject;

                if( pet.Body.IsHuman )
                    from.SendMessage("The person looks at you in disgust.");
                else if( pet.ControlMaster != from )
                    from.SendMessage("That is not your pet.");
                else if( pet.Combatant != null && pet.InRange(pet.Combatant, 12) )
                    from.SendMessage("You cannot do that while your pet is fighting.");
                else if( pet.Controlled == true && pet.ControlMaster == from )
                {
                    if( Utility.Random(15) == 1 )
                    {
                        m_ai.DoMove(Direction.South);
                        m_ai.DoMove(Direction.South);
                        m_ai.DoMove(Direction.East);
                        m_ai.DoMove(Direction.South);
                        m_ai.NextMove = DateTime.Now;

                        from.SendMessage("Your pet shies away from the rope.");
                        pet.PlaySound(pet.GetAngerSound());
                    }
                    else
                    {
                        if( pet.Blessed == false )
                        {
                            pet.Blessed = true;
                            pet.CantWalk = true;
                            pet.ControlOrder = OrderType.Stay;
                            pet.Combatant = null;
                            pet.Loyalty = 85;

                            from.LocalOverheadMessage(MessageType.Regular, from.EmoteHue, false, "*attaches the rope to the animal*");
                            from.Backpack.ConsumeTotal(typeof(HitchingRope), 1);
                            from.SendMessage("Your pet has been hitched to the post.");
                        }
                    }
                }
            }
        }
開發者ID:greeduomacro,項目名稱:hubroot,代碼行數:44,代碼來源:PostToPetTarget.cs

示例2: OnResponse

		public override void OnResponse( NetState state, RelayInfo info )
		{
			Mobile from = state.Mobile;
			BaseCreature toMobile = m_to;

			if( toMobile.Alive )
			{
				m_ai = toMobile.AIObject;

				if( m_ai == null )
				{
					from.SendMessage( "Mobile AI is null or unavailable. Unable to process with this item." );
					return;
				}

				toMobile.CantWalk = false;

				m_ai.NextMove = DateTime.Now + TimeSpan.FromSeconds( 60 );
				DateTime delay = DateTime.Now + TimeSpan.FromSeconds( 60 );

				if( info.ButtonID == 0 )
				{
					from.SendMessage( "You finish controlling " + toMobile.Name );
					m_ai.NextMove = DateTime.Now;
				}

				if( info.ButtonID == 1 )
				{
					m_ai.NextMove = DateTime.Now;
					m_ai.DoMove( Direction.North );
					m_ai.NextMove = delay;
					from.SendGump( new CreatureControl( toMobile, from ) );
				}

				if( info.ButtonID == 2 )
				{
					m_ai.NextMove = DateTime.Now;
					m_ai.DoMove( Direction.East );
					m_ai.NextMove = delay;
					from.SendGump( new CreatureControl( toMobile, from ) );
				}

				if( info.ButtonID == 3 )
				{
					m_ai.NextMove = DateTime.Now;
					m_ai.DoMove( Direction.South );
					m_ai.NextMove = delay;
					from.SendGump( new CreatureControl( toMobile, from ) );
				}

				if( info.ButtonID == 4 )
				{
					m_ai.NextMove = DateTime.Now;
					m_ai.DoMove( Direction.West );
					m_ai.NextMove = delay;
					from.SendGump( new CreatureControl( toMobile, from ) );
				}

				if( info.ButtonID == 5 )
				{
					m_ai.NextMove = DateTime.Now;
					m_ai.DoMove( Direction.Up );
					m_ai.NextMove = delay;
					from.SendGump( new CreatureControl( toMobile, from ) );
				}

				if( info.ButtonID == 6 )
				{
					m_ai.NextMove = DateTime.Now;
					m_ai.DoMove( Direction.Right );
					m_ai.NextMove = delay;
					from.SendGump( new CreatureControl( toMobile, from ) );
				}

				if( info.ButtonID == 7 )
				{
					m_ai.NextMove = DateTime.Now;
					m_ai.DoMove( Direction.Down );
					m_ai.NextMove = delay;
					from.SendGump( new CreatureControl( toMobile, from ) );
				}

				if( info.ButtonID == 8 )
				{
					m_ai.NextMove = DateTime.Now;
					m_ai.DoMove( Direction.Left );
					m_ai.NextMove = delay;
					from.SendGump( new CreatureControl( toMobile, from ) );
				}

				if( info.ButtonID == 9 )
				{
					from.SendMessage( "Who would you like this creature to attack?" );
					from.Target = new CombatTarget( m_ai, toMobile );
				}
			}

		}
開發者ID:greeduomacro,項目名稱:hubroot,代碼行數:98,代碼來源:CreatureController.cs


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