本文整理汇总了C#中GameLiving.MoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.MoveTo方法的具体用法?C# GameLiving.MoveTo怎么用?C# GameLiving.MoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameLiving
的用法示例。
在下文中一共展示了GameLiving.MoveTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SayReceive
public override bool SayReceive(GameLiving source, string str)
{
if (!base.SayReceive(source, str))
return false;
string[] split = str.Split(' ');
switch (split[0])
{
case "create":
ushort id = 286;
if (split.Length > 1)
{
try { id = ushort.Parse(split[1]); }
catch { }
}
m_instance = (Instance)WorldMgr.CreateInstance(id, typeof(Instance));
if (m_instance != null)
Say("Success, instance created.");
else
Say("Instance creation found errors.");
//Try and load a template from the db...
if (split.Length > 2)
{
string load = split[2];
Say("Trying to load instance '" + load + "' template from DB");
m_instance.LoadFromDatabase(load);
}
break;
case "test":
if (m_instance == null)
Say("Instance is currently null.");
else
{
int x = 32361;
int y = 31744;
int z = 16003;
ushort heading = 1075;
if (m_instance.InstanceEntranceLocation != null)
{
x = m_instance.InstanceEntranceLocation.X;
y = m_instance.InstanceEntranceLocation.Y;
z = m_instance.InstanceEntranceLocation.Z;
heading = m_instance.InstanceEntranceLocation.Heading;
}
// save current position so player can use /instance exit
GameLocation saveLocation = new GameLocation(source.Name + "_exit", source.CurrentRegionID, source.X, source.Y, source.Z);
source.TempProperties.setProperty(saveLocation.Name, saveLocation);
Say("Instance ID " + m_instance.ID + ", Skin: " + m_instance.Skin + ", with " + m_instance.Zones.Count + " zones inside the region.");
if (!source.MoveTo(m_instance.ID, x, y, z, heading))
{
Say("Source could not be moved to instance entrance; MoveTo returned false. Now trying to move to current location inside the instance.");
if (!source.MoveTo(m_instance.ID, source.X, source.Y, source.Z, source.Heading))
{
Say("Sorry, that failed as well.");
}
}
}
break;
}
return true;
}
示例2: ThrowLiving
/// <summary>
/// Hurl a player into the air.
/// </summary>
/// <param name="target">The player to hurl into the air.</param>
private void ThrowLiving(GameLiving target)
{
BroadcastMessage(String.Format("{0} is hurled into the air!", target.Name));
// Face the target, then push it 700 units up and 300 - 500 units backwards.
TurnTo(target);
Point3D targetPosition = PositionOfTarget(target, 700, Heading, Util.Random(300, 500));
if (target is GamePlayer)
{
target.MoveTo(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading);
}
else if (target is GameNPC)
{
(target as GameNPC).MoveInRegion(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading, true);
target.ChangeHealth(this, eHealthChangeType.Spell, (int)(target.Health * -0.35));
}
}
示例3: ResurrectLiving
/// <summary>
/// Resurrects living
/// </summary>
/// <param name="living"></param>
protected virtual void ResurrectLiving(GameLiving living)
{
if (m_caster.ObjectState != GameObject.eObjectState.Active) return;
if (m_caster.CurrentRegionID != living.CurrentRegionID) return;
living.Health = living.MaxHealth * m_spell.ResurrectHealth / 100;
int tempManaEnd = m_spell.ResurrectMana / 100;
living.Mana = living.MaxMana * tempManaEnd;
//The spec rez spells are the only ones that have endurance
if (!SpellLine.IsBaseLine)
living.Endurance = living.MaxEndurance * tempManaEnd;
else
living.Endurance = 0;
living.MoveTo(m_caster.CurrentRegionID, m_caster.X, m_caster.Y, m_caster.Z, m_caster.Heading);
GameTimer resurrectExpiredTimer = null;
lock (m_resTimersByLiving.SyncRoot)
{
resurrectExpiredTimer = (GameTimer)m_resTimersByLiving[living];
m_resTimersByLiving.Remove(living);
}
if (resurrectExpiredTimer != null)
{
resurrectExpiredTimer.Stop();
}
GamePlayer player = living as GamePlayer;
if (player != null)
{
player.StopReleaseTimer();
player.Out.SendPlayerRevive(player);
player.UpdatePlayerStatus();
player.Out.SendMessage("You have been resurrected by " + m_caster.GetName(0, false) + "!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.Notify(GamePlayerEvent.Revive, player, new RevivedEventArgs(Caster, Spell));
//Lifeflight add this should make it so players who have been ressurected don't take damage for 5 seconds
RezDmgImmunityEffect rezImmune = new RezDmgImmunityEffect();
rezImmune.Start(player);
IList<GameObject> attackers;
lock (player.Attackers) { attackers = new List<GameObject>(player.Attackers); }
foreach (GameObject attacker in attackers)
{
if (attacker is GameLiving && attacker != living.TargetObject)
attacker.Notify(
GameLivingEvent.EnemyHealed,
attacker,
new EnemyHealedEventArgs(living, m_caster, GameLiving.eHealthChangeType.Spell, living.Health));
}
GamePlayer casterPlayer = Caster as GamePlayer;
if (casterPlayer != null)
{
long rezRps = player.LastDeathRealmPoints * (Spell.ResurrectHealth + 50) / 1000;
if (rezRps > 0)
{
casterPlayer.GainRealmPoints(rezRps);
}
else
{
casterPlayer.Out.SendMessage("The player you resurrected was not worth realm points on death.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
casterPlayer.Out.SendMessage("You thus get no realm points for the resurrect.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
}
}
}
}