本文整理匯總了C#中Server.Mobile.GetDirectionTo方法的典型用法代碼示例。如果您正苦於以下問題:C# Mobile.GetDirectionTo方法的具體用法?C# Mobile.GetDirectionTo怎麽用?C# Mobile.GetDirectionTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Mobile
的用法示例。
在下文中一共展示了Mobile.GetDirectionTo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetDirection
public static string GetDirection(Mobile from, Point3D p)
{
Direction d = from.GetDirectionTo(p);
string direction = "... You can't tell in what direction it lies.";
switch (d)
{
case Direction.Down:
direction = "South East";
break;
case Direction.East:
direction = "East";
break;
case Direction.Left:
direction = "South West";
break;
case Direction.North:
direction = "North";
break;
case Direction.Right:
direction = "North East";
break;
case Direction.South:
direction = "South";
break;
case Direction.Up:
direction = "North West";
break;
case Direction.West:
direction = "West";
break;
}
return direction;
}
示例2: FireWall
public static void FireWall( Mobile from, Mobile target )
{
Effects.SendPacket( from.Location, from.Map, new FlashEffect( FlashType.LightFlash ) );
Effects.PlaySound( from.Location, from.Map, 0x44B );
Direction d = from.GetDirectionTo( target );
int dx, dy;
bool diagonal;
GetDirectionOffset( d, out dx, out dy, out diagonal );
int length = 1 + (int) Math.Min( from.GetDistanceToSqrt( target ), 10 );
for ( int i = 0; i < length; i++ )
{
int x = from.Location.X + ( dx * i );
int y = from.Location.Y + ( dy * i );
Point3D loc = new Point3D( x, y, from.Location.Z );
TimeSpan duration = TimeSpan.FromSeconds( 100.0 - ( i * 9.0 ) );
if ( d == Direction.West || d == Direction.East || diagonal )
new FireFieldItem( from, loc, from.Map, 0x398C, duration );
if ( d == Direction.North || d == Direction.South || diagonal )
new FireFieldItem( from, loc, from.Map, 0x3996, duration );
}
}
示例3: 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.
}
示例4: Target
public static void Target( Mobile from, object target, ACreedJinBori jinbori )
{
if ( from == null || jinbori.Parent != from )
return;
Mobile to = target as Mobile;
if ( to == null )
return;
int delay = 11;
delay -= (from.Dex / 30);
if ( delay < 6 )
delay = 6;
jinbori.ThrowDelay = DateTime.Now + TimeSpan.FromSeconds( delay );
--jinbori.m_Ammo;
from.Direction = from.GetDirectionTo( to );
from.Animate( 31, 5, 1, true, false, 0 );
// SendMovingEffect( IEntity from, IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes )
Effects.SendMovingEffect( from, to, 0xF51, 10, 1, false, false );
Timer.DelayCall( TimeSpan.FromSeconds( 1 ), new TimerStateCallback( jinbori.ACreedDaggerDamage_CallBack ), to );
}
示例5: Abrir
public override void Abrir( Mobile from )
{
PlagueBeastLord m = RootParent as PlagueBeastLord;
if ( m == null ) return;
from.Direction = from.GetDirectionTo( m );
if ( Abierto )
{
from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[21] );
}
else
{
from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[22] );
from.PlaySound( 0x248 );
from.PlaySound( 0x2AC );
Agujero.Visible = true;
base.Abrir( from );
//Si no hay cerebro, la herida empieza a sangrar directamente
if ( HoldBrain == BrainTypes.Brain_None )
{
PlagueBrain pb = Mybrain as PlagueBrain;
pb.Sangrar( from );
}
}
}
示例6: 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 );
}
示例7: OnMine
public void OnMine(Mobile from, Item tool)
{
if (tool is IUsesRemaining && ((IUsesRemaining)tool).UsesRemaining < 1)
return;
from.Direction = from.GetDirectionTo(this.Location);
from.Animate(11, 5, 1, true, false, 0);
Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(DoMine), new object[] { from, tool });
}
示例8: OnTarget
protected override void OnTarget( Mobile from, object obj )
{
if ( m_BaseThrowingItem.Deleted || m_BaseThrowingItem.Map == Map.Internal)
return;
if ( obj is Mobile )
{
Mobile to = (Mobile)obj;
if ( !from.CanBeHarmful( to ) )
{
}
else
{ from.Direction = from.GetDirectionTo( to );
from.Animate( 11, 5, 1, true, false, 0 );
from.MovingEffect( to, m_BaseThrowingItem.ItemID, 10, 0, false, false );
Timer.DelayCall<ThrowInfo>( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback<ThrowInfo>( FinishThrow ), new ThrowInfo( from, to, m_DamageMin, m_DamageMax, m_Break, m_BaseThrowingItem ) );
if ( m_DeleteOnThrow || m_Break )
m_BaseThrowingItem.Delete();
}
}
else
{
IPoint3D p = obj as IPoint3D;
if ( p == null )
return;
Map map = from.Map;
if ( map == null )
return;
IEntity to;
to = new Entity( Serial.Zero, new Point3D( p ), map );
from.Direction = from.GetDirectionTo( to );
Effects.SendMovingEffect( from, to, m_BaseThrowingItem.ItemID & 0x3FFF, 7, 0, false, false, m_BaseThrowingItem.Hue, 0 );
from.Animate( 11, 5, 1, true, false, 0 );
if ( m_DeleteOnThrow )
{
m_BaseThrowingItem.Delete();
from.SendMessage( "You miss the target and the {0} is wasted", m_BaseThrowingItem.Name );
}
else
{
Timer.DelayCall<object[]>( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback<object[]>( FinishMiss ), new object[]{ to, map, m_BaseThrowingItem } );
from.SendMessage( "You miss the target" );
}
}
}
示例9: OnDoubleClick
public virtual void OnDoubleClick( Mobile from, bool createWeedsAndDelete )
{
if( !from.CanSee( this ) )
{
from.SendMessage( "You cannot see that." );
}
else if( !(this is HarvestableTree) && !from.InRange( this, 1 ) )
{
from.SendLocalizedMessage( CommonLocs.YouTooFar );
}
else if( this is HarvestableTree && !from.InRange( this, 2 ) )
{
from.SendLocalizedMessage( CommonLocs.YouTooFar );
}
else if( (Sower != null && from != m_Sower) && !(this is HarvestableTree) )
{
from.SendMessage( "You cannot harvest any of this crop." );
}
else if( from.Mounted )
{
from.SendMessage( "You cannot do this while riding a mount." );
}
else
{
int calcYield = CalculateYield( from );
Item crop = null;
try { crop = CreateCrop( calcYield ); }
catch( Exception e ) { Server.Utilities.ExceptionManager.LogException( "BaseGrownCrop.cs", e ); }
if( crop == null )
{
from.SendMessage( "You are unable to harvest any of this crop!" );
}
else
{
from.AddToBackpack( crop );
from.Direction = from.GetDirectionTo( this );
from.Animate( AnimationFrame, 5, 1, true, false, 0 );
from.PlaySound( 0x133 );
from.SendMessage( "You successfully harvest the crop!" );
}
if( createWeedsAndDelete )
{
new Weeds().MoveToWorld( this.Location, this.Map );
this.Delete();
}
else
{
OnHarvest( from );
}
}
}
示例10: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
IEntity entity = targeted as IEntity;
if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Begging, from.Skills[SkillName.Begging].Value))
{
return;
}
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 is IBegged) )
number = 500403; // That's too far away. You couldn't beg from it anyway.
else if ( targ.Female )
number = 500402; // You are too far away to beg from her.
else
number = 500401; // You are too far away to beg from him.
}
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 if ( targ is IBegged )
{
// Face eachother
from.Direction = from.GetDirectionTo( targ );
targ.Direction = targ.GetDirectionTo( from );
from.Animate( 32, 5, 1, true, false, 0 ); // Bow
new InternalTimer( from, (IBegged)targ ).Start();
m_SetSkillTime = false;
}
else
number = 500404; // They seem unwilling to give you any money.
}
else // Not a Mobile
number = 500399; // There is little chance of getting money from that!
if ( number != -1 )
from.SendLocalizedMessage( number );
}
示例11: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
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 ( !Core.ML && from.Mounted ) // If we're on a mount, who would give us money? TODO: guessed it's removed since ML
{
number = 500404; // They seem unwilling to give you any money.
}
else
{
// 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 );
}
示例12: OnHit
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
{
if ( attacker.FindItemOnLayer( Layer.Arms ) is ACreedBoneArms )
{
if ( defender.Hits < (defender.HitsMax/10) )
damageBonus += 1.5; // +150%
}
// Back Attack
if ( attacker.GetDirectionTo( defender.Location ) == defender.Direction )
damageBonus += 1.0; // +100%
base.OnHit( attacker, defender, damageBonus );
}
示例13: estaNoArcoDeVisao
/**
* Verifica se o observador esta no arco de visão do alvo.
*/
public bool estaNoArcoDeVisao(Mobile observador, Mobile alvo)
{
Direction direcaoObservador = observador.Direction;
Direction direcaoNecessaria = observador.GetDirectionTo(alvo.Location);
int intDirObervador = (int)direcaoObservador;
int intDirNecessaria = (int)direcaoNecessaria;
if (intDirNecessaria == intDirObervador
|| intDirNecessaria == intDirObervador + 1
|| intDirNecessaria == intDirObervador - 1)
{
return true;
}
return false;
}
示例14: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
int number = -1;
if ( targeted is Mobile )
{
Mobile targ = (Mobile)targeted;
if ( targ.Player )
{
number = 500398; // Perhaps just asking would work better.
}
else if ( !targ.Body.IsHuman )
{
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
{
// 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 );
}
示例15: Abrir
public override void Abrir( Mobile from )
{
PlagueBeastLord m = RootParent as PlagueBeastLord;
if ( m == null ) return;
from.Direction = from.GetDirectionTo( m );
if ( Abierto )
{
from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[21] );
}
else
{
from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[22] );
from.PlaySound( 0x248 );
from.PlaySound( 0x2AC );
Gland_Recpt.Visible = true;
Glandula.Visible = true;
}
}