本文整理汇总了C#中Mobile.GetDirectionTo方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.GetDirectionTo方法的具体用法?C# Mobile.GetDirectionTo怎么用?C# Mobile.GetDirectionTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile
的用法示例。
在下文中一共展示了Mobile.GetDirectionTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if ( from == null || !from.Alive ) return;
// lumbervalue = 100; will give 100% sucsess in picking
mageValue = from.Skills[SkillName.Magery].Value + 20;
if ( DateTime.Now > lastpicked.AddSeconds(1) ) // 3 seconds between picking changed to 1 sec
{
lastpicked = DateTime.Now;
if ( from.InRange( this.GetWorldLocation(), 1 ) )
{
if ( mageValue > Utility.Random( 100 ) )
{
from.Direction = from.GetDirectionTo( this );
from.Animate( 32, 5, 1, true, false, 0 ); // Bow
from.SendMessage("You pull the plant up by the root.");
this.Delete();
from.AddToBackpack( new MandrakeUprooted() );
}
else from.SendMessage("The plant is hard to pull up.");
}
else
{
from.SendMessage( "You are too far away to harvest anything." );
}
}
}
示例2: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Item.Deleted )
return;
if ( targeted is ILockpickable )
{
Item item = (Item)targeted;
from.Direction = from.GetDirectionTo( item );
if ( ((ILockpickable)targeted).Locked )
{
from.PlaySound( 0x241 );
new InternalTimer( from, (ILockpickable)targeted, m_Item ).Start();
}
else
{
// The door is not locked
from.SendLocalizedMessage( 502069 ); // This does not appear to be locked
}
}
else
{
from.SendLocalizedMessage( 501666 ); // You can't unlock that!
}
}
示例3: OnTarget
protected override void OnTarget( Mobile from, object targeted ) {
if( m_Item.Deleted )
return;
if( targeted is ILockpickable ) {
Item item = (Item)targeted;
from.Direction = from.GetDirectionTo( item );
Rogue rge = Perk.GetByType<Rogue>((Player)from);
if( ((ILockpickable)targeted).Locked )
{
if (rge == null || !rge.SafeCracker())
from.PlaySound(0x241);
new InternalTimer( from, (ILockpickable)targeted, m_Item ).Start();
}
else if( targeted is BaseDoor && ((BaseDoor)targeted).Picker == from )
{
if( from.CheckTargetSkill( SkillName.Lockpicking, targeted, ((ILockpickable)targeted).LockLevel, ((ILockpickable)targeted).MaxLockLevel ) )
{
from.SendMessage( "You quickly relock the door." );
((BaseDoor)targeted).Relock();
if (rge == null || !rge.SafeCracker())
from.PlaySound(0x4A);
} else
from.SendMessage( "You are unable to relock the door." );
} else
from.SendLocalizedMessage( 502069 ); // This does not appear to be locked
} else
from.SendLocalizedMessage( 501666 ); // You can't unlock that!
}
示例4: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
bool releaselock = true;
if (!m_Item.Deleted)
{
if (targeted is ILockpickable)
{
Item item = (Item)targeted;
from.Direction = from.GetDirectionTo(item);
if (((ILockpickable)targeted).Locked)
{
from.PlaySound(0x241);
releaselock = false;
new InternalTimer(from, (ILockpickable)targeted, m_Item).Start();
}
else
{
// The door is not locked
from.SendLocalizedMessage(502069); // This does not appear to be locked
}
}
else
{
from.SendLocalizedMessage(501666); // You can't unlock that!
}
}
if (releaselock && from is PlayerMobile)
((PlayerMobile)from).EndPlayerAction();
}
示例5: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if ( from == null || !from.Alive ) return;
// lumbervalue = 100; will give 100% sucsess in picking
lumberValue = from.Skills[SkillName.Lumberjacking].Value / 5;
if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking
{
lastpicked = DateTime.Now;
if ( from.InRange( this.GetWorldLocation(), 2 ) )
{
if ( lumberValue > Utility.Random( 100 ) )
{
from.Direction = from.GetDirectionTo( this );
from.Animate( 32, 5, 1, true, false, 0 ); // Bow
from.SendMessage(AgriTxt.PullRoot);
this.Delete();
from.AddToBackpack( new NightshadeUprooted() );
}
else from.SendMessage(AgriTxt.HardPull);
}
else
{
from.SendMessage(AgriTxt.HardPull);
}
}
}
示例6: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
Direction dir;
if ( from.Location != this.Location )
dir = from.GetDirectionTo( this );
else if ( this.East )
dir = Direction.West;
else
dir = Direction.North;
from.Direction = dir;
bool canThrow = true;
if ( !from.InRange( this, 4 ) || !from.InLOS( this ) )
canThrow = false;
else if ( this.East )
canThrow = ( dir == Direction.Left || dir == Direction.West || dir == Direction.Up );
else
canThrow = ( dir == Direction.Up || dir == Direction.North || dir == Direction.Right );
if ( canThrow )
Throw( from );
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
示例7: Shoot
public static void Shoot(Mobile from, Mobile target, INinjaWeapon weapon)
{
if (from != target && (!(from is PlayerMobile) || CanUseWeapon((PlayerMobile)from, weapon)) && from.CanBeHarmful(target))
{
if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
{
if(from is PlayerMobile)
((PlayerMobile)from).NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo(target);
from.RevealingAction();
weapon.AttackAnimation(from, target);
ConsumeUse(weapon);
if (CombatCheck(from, target))
{
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback<object[]>(OnHit), new object[] { from, target, weapon });
}
if(from is PlayerMobile)
Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback<PlayerMobile>(ResetUsing), (PlayerMobile)from);
}
else
{
from.SendLocalizedMessage(1063303); // Your target is too close!
}
}
}
示例8: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is Mobile )
{
from.SendLocalizedMessage( 502816 ); // You feel that such an action would be inappropriate
}
else if ( targeted is TrapableContainer )
{
TrapableContainer targ = (TrapableContainer)targeted;
from.Direction = from.GetDirectionTo( targ );
if ( !targ.Trapped )
{
from.SendLocalizedMessage( 502373 ); // That doesn't appear to be trapped
return;
}
from.PlaySound( 0x241 );
if ( from.CheckTargetSkill( SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30 ) )
{
targ.Trapped = false;
from.SendLocalizedMessage( 502377 ); // You successfully render the trap harmless
}
else
{
from.SendLocalizedMessage( 502372 ); // You fail to disarm the trap... but you don't set it off
}
}
else
{
from.SendLocalizedMessage( 502373 ); // That does'nt appear to be trapped
}
}
示例9: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
if( targeted is Mobile )
{
from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
}
else if( targeted is TrapableContainer )
{
TrapableContainer targ = (TrapableContainer)targeted;
from.Direction = from.GetDirectionTo(targ);
if( targ.TrapType == TrapType.None )
{
from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
return;
}
from.PlaySound(0x241);
if( from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30) )
{
targ.TrapPower = 0;
targ.TrapLevel = 0;
targ.TrapType = TrapType.None;
from.SendLocalizedMessage(502377); // You successfully render the trap harmless
}
else
{
from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
}
}
else if( targeted is BaseDoor && ((BaseDoor)targeted).TrapAvailable )
{
if( from.CheckTargetSkill(SkillName.RemoveTrap, targeted, (targeted is BaseHouseDoor ? 95.0 : 75.0), (targeted is BaseHouseDoor ? 120.0 : 100.0)) )
{
from.SendLocalizedMessage(502377); //You successfully render the trap harmless.
((BaseDoor)targeted).RemoveTrap();
}
else
{
if( 0.20 >= Utility.RandomDouble() )
{
from.SendMessage("You fail to disarm the trap, and accidentally set it off!");
((BaseDoor)targeted).DoorTrap.Trigger(from);
}
else
from.SendLocalizedMessage(502372);
}
}
else
{
from.SendLocalizedMessage(502373); // That does'nt appear to be trapped
}
EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.RemoveTrap]));
}
示例10: Use
public void Use( Mobile from, BaseWeapon weapon )
{
BeginSwing();
from.Direction = from.GetDirectionTo( GetWorldLocation() );
weapon.PlaySwingAnimation( from );
from.CheckSkill( weapon.Skill, m_MinSkill, m_MaxSkill );
}
示例11: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
bool releaseLock = true;
int number = -1;
if ( targeted is Mobile )
{
Mobile targ = (Mobile)targeted;
if ( targ.Player ) // We can't beg from players
{
number = 500398; // Perhaps just asking would work better.
}
else if ( !targ.Body.IsHuman ) // Make sure the NPC is human
{
number = 500399; // There is little chance of getting money from that!
}
else if ( !from.InRange( targ, 2 ) )
{
if ( !targ.Female )
number = 500401; // You are too far away to beg from him.
else
number = 500402; // You are too far away to beg from her.
}
else if ( from.Mounted ) // If we're on a mount, who would give us money?
{
number = 500404; // They seem unwilling to give you any money.
}
else
{
releaseLock = false;
// Face eachother
from.Direction = from.GetDirectionTo( targ );
targ.Direction = targ.GetDirectionTo( from );
from.Animate( 32, 5, 1, true, false, 0 ); // Bow
new InternalTimer( from, targ ).Start();
m_SetSkillTime = false;
}
}
else // Not a Mobile
{
number = 500399; // There is little chance of getting money from that!
}
if ( number != -1 )
from.SendLocalizedMessage( number );
if (releaseLock && from is PlayerMobile)
((PlayerMobile)from).EndPlayerAction();
}
示例12: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is Mobile )
{
Mobile m = (Mobile)targeted;
if ( m != from && from.HarmfulCheck( m ) )
{
Direction to = from.GetDirectionTo( m );
from.Direction = to;
from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 );
if ( Utility.RandomDouble() <= (Math.Sqrt( from.Dex / 100.0 ) * 1.0) )
{
from.MovingEffect( m, 0x10E5, 7, 1, false, false, 0x481, 0 );
AOS.Damage( m, from, Utility.Random( 5, from.Str / 10 ), 100, 0, 0, 0, 0 );
m.Paralyze( TimeSpan.FromSeconds( 10 ) );
Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ReleasecastLock ), from );
}
else
{
int x = 0, y = 0;
switch ( to & Direction.Mask )
{
case Direction.North: --y; break;
case Direction.South: ++y; break;
case Direction.West: --x; break;
case Direction.East: ++x; break;
case Direction.Up: --x; --y; break;
case Direction.Down: ++x; ++y; break;
case Direction.Left: --x; ++y; break;
case Direction.Right: ++x; --y; break;
}
x += Utility.Random( -1, 3 );
y += Utility.Random( -1, 3 );
x += m.X;
y += m.Y;
from.MovingEffect( m_MBoomerang, 0x10E5, 7, 1, false, false, 0x481, 0 );
from.SendMessage( "You miss." );
Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ReleasecastLock ), from );
}
}
}
}
示例13: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
var weapon = from.Weapon as BaseWeapon;
Direction dir;
if (from.Location != Location)
{
dir = from.GetDirectionTo(this);
}
else if (East)
{
dir = Direction.West;
}
else
{
dir = Direction.North;
}
from.Direction = dir;
bool canThrow = true;
if (!from.InRange(this, 5) || !from.InLOS(this))
{
canThrow = false;
}
else if (East)
{
canThrow = (dir == Direction.Left || dir == Direction.West || dir == Direction.Up);
}
else
{
canThrow = (dir == Direction.Up || dir == Direction.North || dir == Direction.Right);
}
if (canThrow)
{
if (from.FindItemOnLayer(Layer.OneHanded) == null)
{
PunchMongbat(from, weapon);
}
else if (weapon is BaseKnife)
{
ThrowKnife(from);
}
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
示例14: Use
public void Use( Mobile from )
{
from.Direction = from.GetDirectionTo( GetWorldLocation() );
Effects.PlaySound( GetWorldLocation(), Map, 0x4F );
if ( from.CheckSkill( SkillName.Stealing, m_MinSkill, m_MaxSkill ) )
{
SendLocalizedMessageTo( from, 501834 ); // You successfully avoid disturbing the dip while searching it.
}
else
{
Effects.PlaySound( GetWorldLocation(), Map, 0x390 );
BeginSwing();
ProcessDelta();
SendLocalizedMessageTo( from, 501831 ); // You carelessly bump the dip and start it swinging.
}
}
示例15: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Item.Deleted )
return;
if ( targeted is ILockpickable )
{
ILockpickable item = (ILockpickable)targeted;
from.Direction = from.GetDirectionTo( item );
if (targeted is Item)
{
Item targetedItem = (Item)targeted;
if (!from.InRange((IPoint2D)targeted, 2))
{
if (targetedItem.RootParentEntity != from)
{
from.SendLocalizedMessage(500446);
}
}
}
if ( item.Locked )
{
from.PlaySound( 0x241 );
new InternalTimer( from, item, m_Item ).Start();
}
else
{
// The door is not locked
from.SendLocalizedMessage( 502069 ); // This does not appear to be locked
}
}
else
{
from.SendLocalizedMessage( 501666 ); // You can't unlock that!
}
}