本文整理汇总了C#中Unit.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.Move方法的具体用法?C# Unit.Move怎么用?C# Unit.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit.Move方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProvideAction
public void ProvideAction(Unit activePlayer) {
if (Input.GetKey (KeyCode.W)) {
activePlayer.Move (1);
return;
}
if (Input.GetKey (KeyCode.E)) {
activePlayer.Move (2);
return;
}
if (Input.GetKey (KeyCode.D)) {
activePlayer.Move (3);
return;
}
if (Input.GetKey (KeyCode.X)) {
activePlayer.Move (4);
return;
}
if (Input.GetKey (KeyCode.Z)) {
activePlayer.Move (5);
return;
}
if (Input.GetKey (KeyCode.A)) {
activePlayer.Move (6);
return;
}
}
示例2: Combat
public void Combat(Unit attacker, Unit defender)
{
if(attacker.Buffs.Exists(b => b is DeathTouchBuff))
defender.Kill();
else
defender.Damage(attacker.Attack);
if(!attacker.IsRanged()) {
if(defender.Buffs.Exists(b => b is DeathTouchBuff))
attacker.Kill();
else
attacker.Damage(defender.Attack);
}
attacker.Move(attacker.MovementLeft());
}
示例3: AutoJumpBack
/// <summary>
/// Tries to jump back if ult is casted by the player itself
/// (everytime as far as force staff / blink dagger is ready)
/// </summary>
public static void AutoJumpBack(bool onCoolDown, Unit me)
{
if (DelayHandler.UltimateInAutomaticUse || DelayHandler.AutoJumpBackItemChosen)
return;
if (onCoolDown) //in seconds
{
#region initItemCast
if (MyItems.BlinkDagger.HasBlinkDaggerReady &&
!DelayHandler.ContainsParticulatMethod(DelayHandler.Descriptions.BlinkDaggerCast))
{
DelayHandler.AutoJumpBackItemChosen = true;
Vector2 originPos = KeyHandler.logPos;
/*ports after jumping*/
Vector2 meOriginVec = originPos - me.Position.ToVector2();
//stretched by cast range units
meOriginVec = Vector2.Multiply(meOriginVec, (meOriginVec.Length() +
MyItems.BlinkDagger.CastRange) / meOriginVec.Length());
//stretched by 500 units
Vector2 moveToDirVec = Vector2.Multiply(meOriginVec, (meOriginVec.Length() +
MyItems.BlinkDagger.CastRange + 500) / meOriginVec.Length());
Vector2 portPosAfterUltimate = me.Position.ToVector2() + meOriginVec;
Vector2 movePosAfterPort = me.Position.ToVector2() + moveToDirVec;
DelayHandler.Add(delegate
{
MyItems.BlinkDagger.TheItem.UseAbility(portPosAfterUltimate.ToVector3());
}, stdCastDelay, DelayHandler.Descriptions.BlinkDaggerCast);
DelayHandler.Add(delegate { me.Move(movePosAfterPort.ToVector3()); }, stdCastDelay + 50,
DelayHandler.Descriptions.Move);
}
else if (MyItems.ForceStaff.HasForceStaffReady &&
!DelayHandler.ContainsParticulatMethod(DelayHandler.Descriptions.ForceStaffCast))
{
DelayHandler.AutoJumpBackItemChosen = true;
Vector2 originPos = KeyHandler.logPos;
// me.Move(originPos.ToVector3());
DelayHandler.MoveSpammer.Involke(originPos.ToVector3(), stdCastDelay);
/*moves after jumping*/
Vector2 meOriginDirVec = originPos - me.Position.ToVector2();
//stretched by 500 units
meOriginDirVec = Vector2.Multiply(meOriginDirVec, (meOriginDirVec.Length() + 500) / meOriginDirVec.Length());
Vector2 MovePosAfterJump = me.Position.ToVector2() + meOriginDirVec;
DelayHandler.Add(delegate
{
MyItems.ForceStaff.TheItem.UseAbility(me);
}, stdCastDelay, DelayHandler.Descriptions.ForceStaffCast);
DelayHandler.Add(delegate { me.Move(MovePosAfterJump.ToVector3()); },
stdCastDelay + 50,
DelayHandler.Descriptions.Move);
}
#endregion initItemCast
}
}
示例4: Buff
void Buff(Unit unit)
{
unit.Move(int.MaxValue);
}
示例5: SafeTp
private static bool SafeTp(Unit me, Ability w)
{
if (true) //(Menu.Item("AutoHeal.Hero.Enable").GetValue<bool>())
{
var handle = me.Handle;
bool nh;
if (!NeedHeal.TryGetValue(handle, out nh))
NeedHeal.Add(handle, false);
var perc = me.Health/(float) me.MaximumHealth*100;
//Print(String.Format("Health: {0}, Max Health: {1}, Percent: {2}", Me.Health, Me.MaximumHealth, perc));
if (NeedHeal[handle])
{
if ((perc > 95 &&
me.HasModifiers(new[] {"modifier_fountain_aura", "modifier_fountain_aura_buff"}, false)) ||
OrderStates[handle] != OrderState.Escape)
{
NeedHeal[handle] = false;
var newOrder = LastOrderStates[handle] != OrderState.Escape
? LastOrderStates[handle]
: OrderState.Idle;
OrderStates[handle] = _globalTarget == null ? newOrder/*OrderState.Idle*/ : OrderState.InCombo;
//Print(newOrder.ToString());
//Print("im full now ["+handle+"]");
}
else if (!me.HasModifiers(new[] {"modifier_fountain_aura", "modifier_fountain_aura_buff"}, false))
{
if (Utils.SleepCheck("move check" + handle))
{
var anyEnemyHero =
Heroes.GetByTeam(me.GetEnemyTeam())
.FirstOrDefault(x => x.IsAlive && x.IsVisible && x.Distance2D(me) <= 800);
if (anyEnemyHero != null)
{
var spell = SpellQ[handle];
if (spell != null && spell.CanBeCasted() && !anyEnemyHero.HasModifier("modifier_meepo_earthbind"))
{
spell.CastSkillShot(anyEnemyHero);
}
}
var anyAllyMeepoNearBase =
_meepoList.Where(
x =>
!Equals(x, me) && x.Distance2D(Fountains.GetAllyFountain()) <= 5000 &&
!Heroes.GetByTeam(me.GetEnemyTeam()).Any(y => y.IsAlive && y.IsVisible && y.Distance2D(x) <= 1500))
.OrderBy(z => z.Distance2D(Fountains.GetAllyFountain())).FirstOrDefault();
var underTower = Towers.All.Where(x => x.Team == me.GetEnemyTeam())
.Any(x => x.Distance2D(me) <= 800);
if (anyAllyMeepoNearBase != null && w.CanBeCasted() && !underTower)
{
if (Utils.SleepCheck("poofTimeToBase" + handle))
{
w.UseAbility(anyAllyMeepoNearBase.Position);
Utils.Sleep(2000, "poofTimeToBase" + handle);
}
}
var channeledAbility = me.GetChanneledAbility();
var travelBoots = me.FindItem("item_travel_boots", true) ??
me.FindItem("item_travel_boots_2", true) ??
me.FindItem("item_tpscroll", true);
if (me.IsChanneling() && channeledAbility.Name != "item_travel_boots"
&& channeledAbility.Name != "item_travel_boots_2" &&
channeledAbility.Name != "item_tpscroll")
{
//do nothing while in tp
}
else if (!underTower && travelBoots != null && travelBoots.CanBeCasted() &&
me.Distance2D(Fountains.GetAllyFountain()) >= 5000 && Utils.SleepCheck("tp_cd" + handle) && Utils.SleepCheck("poofTimeToBase" + handle))
{
Utils.Sleep(250, "tp_cd" + handle);
travelBoots.UseAbility(Fountains.GetAllyFountain().Position);
}
else
{
me.Move(Fountains.GetAllyFountain().Position);
}
Utils.Sleep(500, "move check"+handle);
}
}
}
else
{
if (perc < Menu.Item("Escape.MinRangePercent").GetValue<Slider>().Value || me.Health <= Menu.Item("Escape.MinRange").GetValue<Slider>().Value)
{
//Print("hp too low, go to fountain. Perc: "+perc);
NeedHeal[handle] = true;
LastOrderStates[handle] = OrderStates[handle] == OrderState.Escape
? OrderState.Idle
: OrderStates[handle];
OrderStates[handle] = OrderState.Escape;
}
else
{
//Print("checking for hp");
}
}
return NeedHeal[handle];
}
}
示例6: Hotkey_ValueChanged
// ReSharper disable once InconsistentNaming
private static void Hotkey_ValueChanged(object sender, OnValueChangeEventArgs e)
{
var newVal = e.GetNewValue<KeyBind>().Active;
if (newVal != e.GetOldValue<KeyBind>().Active)
{
// Deactivate script
if (!newVal)
{
pullCreep = null;
}
else
{
// Activate script
var player = ObjectMgr.LocalPlayer;
if (player == null || player.Team == Team.Observer)
return;
switch (player.Team)
{
case Team.Radiant:
startTime = StartTimeRadiant;
attackTime = AttackTimeRadiant;
route = StackRouteRadiant;
break;
case Team.Dire:
startTime = StartTimeDire;
attackTime = AttackTimeDire;
route = StackRouteDire;
break;
default:
e.Process = false;
return;
}
var units = player.Selection.ToList();
pullCreep = (Unit)units.FirstOrDefault(unit => unit is Unit && ((Unit)unit).IsControllable && ((Unit)unit).IsRanged);
if (pullCreep != null)
{
pullCreep.Move(route.Last());
orderState = -1;
}
else e.Process = false;
}
}
}
示例7: SmartAttack
private static void SmartAttack(Unit me, List<Unit> myCreeps, Unit nearestTower, Vector3 pos)
{
var name = me.StoredName();
if (Menu.Item("AutoPush.UnAggro.Enable").GetValue<bool>() &&
myCreeps.Any(x => x.Distance2D(nearestTower) <= 800) && me.Distance2D(nearestTower) <= 1000)
{
var hpwasChanged = CheckForChangedHealth(me);
if (hpwasChanged)
{
var allyCreep = myCreeps.OrderBy(x => x.Distance2D(me)).First();
if (allyCreep != null)
{
var towerPos = nearestTower.Position;
var ang = allyCreep.FindAngleBetween(towerPos, true);
var p = new Vector3((float) (allyCreep.Position.X - 250*Math.Cos(ang)),
(float) (allyCreep.Position.Y - 250*Math.Sin(ang)), 0);
me.Move(p);
me.Attack(allyCreep, true);
Utils.Sleep(1200, name + "attack");
}
else
{
var towerPos = nearestTower.Position;
var ang = me.FindAngleBetween(towerPos, true);
var p = new Vector3((float) (me.Position.X - 1000*Math.Cos(ang)),
(float) (me.Position.Y - 1000*Math.Sin(ang)), 0);
me.Move(p);
Utils.Sleep(500, name + "attack");
}
}
else
{
me.Attack(pos);
Utils.Sleep(500, name + "attack");
}
}
else
{
me.Attack(pos);
Utils.Sleep(500, name + "attack");
}
}
示例8: Game_OnGameWndProc
static void Game_OnGameWndProc(WndEventArgs args)
{
if (args.Msg != WM_KEYUP || args.WParam != 'O' || Game.IsChatOpen)
return;
// Deactivate script
if (_pullCreep != null)
{
Console.WriteLine("Deactivated");
_pullCreep = null;
return;
}
// Activate script
var player = EntityList.GetLocalPlayer();
if (player == null)
return;
switch (player.Team)
{
case Team.Radiant:
_startTime = StartTimeRadiant;
_attackTime = AttackTimeRadiant;
_route = StackRouteRadiant;
break;
case Team.Dire:
_startTime = StartTimeDire;
_attackTime = AttackTimeDire;
_route = StackRouteDire;
break;
default:
return;
}
var units = player.Selection.ToList();
_pullCreep = (Unit)units.FirstOrDefault(unit => unit is Unit && ((Unit)unit).IsControllable && ((Unit)unit).IsRanged);
if (_pullCreep != null)
{
_pullCreep.Move(_route.Last());
_orderState = -1;
}
}