本文整理汇总了C#中Projectile.Launch方法的典型用法代码示例。如果您正苦于以下问题:C# Projectile.Launch方法的具体用法?C# Projectile.Launch怎么用?C# Projectile.Launch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projectile
的用法示例。
在下文中一共展示了Projectile.Launch方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public override IEnumerable<TickTimer> Main()
{
StartCooldown(EvalTag(PowerKeys.CooldownTime));
UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
int numProjectiles = Rune_B > 0 ? (int)ScriptFormula(4) : 1;
for (int n = 0; n < numProjectiles; ++n)
{
if (Rune_B > 0)
yield return WaitSeconds(ScriptFormula(17));
var proj = new Projectile(this,
RuneSelect(107011, 107030, 107035, 107223, 107265, 107114),
User.Position);
proj.Position.Z += 3f;
proj.OnCollision = (hit) =>
{
// TODO: fix positioning of hit actors. possibly increase model scale?
SpawnEffect(RuneSelect(112327, 112338, 112327, 112345, 112347, 112311), proj.Position);
proj.Destroy();
if (Rune_E > 0 && Rand.NextDouble() < ScriptFormula(11))
hit.PlayEffectGroup(107163);
if (Rune_A > 0)
WeaponDamage(hit, ScriptFormula(2), DamageType.Fire);
else
WeaponDamage(hit, ScriptFormula(0), DamageType.Poison);
};
proj.Launch(TargetPosition, 1f);
}
}
示例2: Main
public override IEnumerable<TickTimer> Main()
{
GeneratePrimaryResource(ScriptFormula(17));
// fire projectile normally, or find targets in arc if RuneB
Vector3D[] targetDirs;
if (Rune_B > 0)
{
targetDirs = new Vector3D[(int)ScriptFormula(24)];
int takenPos = 0;
foreach (Actor actor in GetEnemiesInArcDirection(User.Position, TargetPosition, 75f, ScriptFormula(12)).Actors)
{
targetDirs[takenPos] = actor.Position;
++takenPos;
if (takenPos >= targetDirs.Length)
break;
}
// generate any extra positions using generic spread
if (takenPos < targetDirs.Length)
{
PowerMath.GenerateSpreadPositions(User.Position, TargetPosition, 10f, targetDirs.Length - takenPos)
.CopyTo(targetDirs, takenPos);
}
}
else
{
targetDirs = new Vector3D[] { TargetPosition };
}
foreach (Vector3D position in targetDirs)
{
var proj = new Projectile(this, RuneSelect(77569, 153864, 153865, 153866, 153867, 153868), User.Position);
proj.Position.Z += 5f; // fix height
proj.OnCollision = (hit) =>
{
// hit effect
hit.PlayEffectGroup(RuneSelect(77577, 153870, 153872, 153873, 153871, 153869));
if (Rune_B > 0)
WeaponDamage(hit, ScriptFormula(9), DamageType.Poison);
else
AddBuff(hit, new ExplosionBuff());
proj.Destroy();
};
proj.Launch(position, ScriptFormula(2));
if (Rune_B > 0)
yield return WaitSeconds(ScriptFormula(13));
}
}
示例3: _RuneC
IEnumerable<TickTimer> _RuneC()
{
var demon = new Projectile(this, 155276, TargetPosition);
demon.Timeout = WaitSeconds(ScriptFormula(30));
TickTimer grenadeTimer = null;
demon.OnUpdate = () =>
{
if (grenadeTimer == null || grenadeTimer.TimedOut)
{
grenadeTimer = WaitSeconds(ScriptFormula(31));
demon.PlayEffect(Effect.Sound, 215621);
var grenade = new Projectile(this, 152589, demon.Position);
grenade.Position.Z += 18f; // make it spawn near demon's cannon
grenade.Timeout = WaitSeconds(ScriptFormula(33));
grenade.OnTimeout = () =>
{
grenade.PlayEffectGroup(154020);
WeaponDamage(GetEnemiesInRadius(grenade.Position, ScriptFormula(32)), ScriptFormula(0), DamageType.Fire);
};
grenade.LaunchArc(demon.Position, 0.1f, -0.1f, 0.6f); // parameters not based on anything, just picked to look good
}
};
bool firstLaunch = true;
while (!demon.Timeout.TimedOut)
{
demon.Launch(RandomDirection(TargetPosition, 0f, ScriptFormula(7)), 0.2f);
if (firstLaunch)
{
demon.PlayEffectGroup(165237);
firstLaunch = false;
}
yield return demon.ArrivalTime;
}
}
示例4: Update
public override bool Update()
{
if (base.Update())
return true;
if (_damageTimer == null || _damageTimer.TimedOut)
{
_damageTimer = WaitSeconds(ScriptFormula(0));
UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
//TODO: THIS is where Rune_E goes. On Crit Hits, restores some HP.
WeaponDamage(GetEnemiesInRadius(User.Position, ScriptFormula(2)),
ScriptFormula(1), Rune_A > 0 ? DamageType.Fire : DamageType.Physical);
}
if (Rune_B > 0)
{
// spawn tornado projectiles in random directions every timed period
if (_tornadoSpawnTimer == null)
_tornadoSpawnTimer = WaitSeconds(ScriptFormula(5));
if (_tornadoSpawnTimer.TimedOut)
{
_tornadoSpawnTimer = WaitSeconds(ScriptFormula(5));
var tornado = new Projectile(this, 162386, User.Position);
tornado.Timeout = WaitSeconds(3f);
tornado.OnCollision = (hit) =>
{
WeaponDamage(hit, ScriptFormula(6), DamageType.Physical);
};
tornado.Launch(new Vector3D(User.Position.X + (float)Rand.NextDouble() - 0.5f,
User.Position.Y + (float)Rand.NextDouble() - 0.5f,
User.Position.Z), 0.25f);
}
}
return false;
}
示例5: Main
public override IEnumerable<TickTimer> Main()
{
bool hitAnything = false;
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetBestMeleeEnemy();
attack.AddWeaponDamage(2f, DamageType.Physical);
attack.OnHit = hitPayload =>
{
hitAnything = true;
AddBuff(User, new FrenzyBuff());
if (Rune_C > 0)
{
AddBuff(User, new ObsidianSpeedEffect());
}
if (Rune_B > 0)
{
if (Rand.NextDouble() < ScriptFormula(17))
{
Actor target = GetEnemiesInRadius(User.Position, 15f).GetClosestTo(User.Position);
var proj = new Projectile(this, RuneSelect(6515, 130073, 215555, -1, 216040, 75650), User.Position);
proj.Position.Z += 5f; // fix height
proj.OnCollision = (hit) =>
{
WeaponDamage(hit, ScriptFormula(18), DamageType.Physical);
};
proj.Launch(target.Position, 2f);
}
}
if (Rune_D > 0)
{
if (Rand.NextDouble() < 1)
{
hitPayload.Target.PlayEffectGroup(163470);
AddBuff(hitPayload.Target, new DebuffStunned(WaitSeconds(ScriptFormula(0))));
}
}
};
attack.OnDeath = DeathPayload =>
{
if (Rune_E > 0)
{
User.Attributes[GameAttribute.Hitpoints_Granted_Duration] += (int)ScriptFormula(12);
User.Attributes[GameAttribute.Hitpoints_Granted] += ScriptFormula(10) * User.Attributes[GameAttribute.Hitpoints_Max_Total];
User.Attributes.BroadcastChangedIfRevealed();
}
};
attack.Apply();
if (hitAnything)
GeneratePrimaryResource(EvalTag(PowerKeys.ResourceGainedOnFirstHit) + ScriptFormula(19));
yield break;
}
示例6: Main
public override IEnumerable<TickTimer> Main()
{
if (Rune_B > 0)
{
IList<Actor> targets = new List<Actor>() { Target };
Actor ropeSource = User;
Actor curTarget = Target;
float damage = ScriptFormula(15);
while (targets.Count < ScriptFormula(5) + 1)
{
if (ropeSource.World == null)
ropeSource = SpawnProxy(ropeSource.Position);
if (curTarget.World != null)
{
ropeSource.AddRopeEffect(166450, curTarget);
ropeSource = curTarget;
WeaponDamage(curTarget, damage, DamageType.Physical);
}
else
{
break;
}
curTarget = GetEnemiesInRadius(curTarget.Position, ScriptFormula(12), (int)ScriptFormula(5)).Actors.FirstOrDefault(t => !targets.Contains(t));
if (curTarget != null)
{
targets.Add(curTarget);
yield return WaitSeconds(0.150f);
}
else
{
break;
}
}
}
else
{
var proj = new Projectile(this, RuneSelect(100800, 100839, 166438, 100832, 101057, 100934), User.Position);
proj.Position.Z += 5f; // fix height
proj.OnCollision = (hit) =>
{
hit.PlayEffectGroup(RuneSelect(18707, 166333, 16634, 166335, -1, 166339));
WeaponDamage(hit, ScriptFormula(15), DamageType.Physical);
if (Rune_C > 0)
{
if (Rand.NextDouble() < ScriptFormula(0))
{
AddBuff(hit, new DebuffStunned(WaitSeconds(ScriptFormula(7))));
}
}
if (Rune_D > 0)
{
float CurrentResource = User.Attributes[GameAttribute.Resource_Cur];
//Use remaining Fury points. Get Remaining Fury Points, use that to multiply against SF(18), and add that to total damage.
float DamageTotal = ScriptFormula(15) + (ScriptFormula(18) * CurrentResource);
WeaponDamage(GetEnemiesInRadius(hit.Position, ScriptFormula(19)), DamageTotal, DamageType.Physical);
}
if (Rune_E > 0)
{
if (Rand.NextDouble() < 1)
{
AddBuff(hit, new ConfuseDebuff());
//This will cause a buff on the target hit, changing their attack from the User, to other Mobs.
}
}
proj.Destroy();
};
proj.Launch(TargetPosition, 1.5f);
}
yield break;
}
示例7: Main
//From videos: it seems you proxy the Proxy actor first, the "hit" looks like it goes with the projectile...
public override IEnumerable<TickTimer> Main()
{
StartCooldown(EvalTag(PowerKeys.CooldownTime));
//UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
//projectile distance (50)
if (Rune_B > 0)
{
Vector3D[] projDestinations = PowerMath.GenerateSpreadPositions(User.Position, TargetPosition, 45f, (int)ScriptFormula(25));
yield return WaitSeconds(0.35f);
for (int i = 0; i < projDestinations.Length; i++)
{
var proj = new Projectile(this, 172310, User.Position);
proj.Launch(projDestinations[i], ScriptFormula(22));
proj.OnCollision = (hit) =>
{
hit.PlayEffectGroup(145443);
proj.Destroy();
WeaponDamage(hit, ScriptFormula(23), DamageType.Holy);
};
}
}
else if (Rune_C > 0)
{
//add in pillar [temple.efg and hit_hp.acr and pillar_a.acr?]
Vector3D inFrontOfUser = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, ScriptFormula(8));
yield return WaitSeconds(0.35f);
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInRadius(inFrontOfUser, 20f);
attack.AddWeaponDamage(ScriptFormula(17), DamageType.Holy);
attack.OnHit = hit =>
{
Knockback(hit.Target, ScriptFormula(5), ScriptFormula(6), ScriptFormula(7));
AddBuff(hit.Target, new DOTbuff(WaitSeconds(ScriptFormula(9))));
};
}
else
{
Vector3D inFrontOfUser = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, ScriptFormula(8));
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInRadius(inFrontOfUser, 10f);
attack.AddWeaponDamage(ScriptFormula(14), DamageType.Holy);
attack.OnHit = hit =>
{
if (hit.IsCriticalHit)
{
AddBuff(hit.Target, new DebuffStunned(WaitSeconds(ScriptFormula(39))));
}
};
yield return WaitSeconds(0.35f);
var proj = new Projectile(this, 6441, User.Position);
proj.Position.Z += 5f; // fix height
proj.OnCollision = (hit) =>
{
hit.PlayEffectGroup(144079);
WeaponDamage(hit, ScriptFormula(3), DamageType.Holy);
Knockback(User, ScriptFormula(15), ScriptFormula(18), ScriptFormula(20));
};
proj.Launch(TargetPosition, ScriptFormula(2));
}
yield break;
}
示例8: Run
public override IEnumerable<TickTimer> Run()
{
UsePrimaryResource(20f);
User.PlayEffectGroup(19305); // cast effect
var projectile = new Projectile(this, 99567, User.Position);
projectile.OnCollision = (hit) =>
{
SpawnEffect(99572, new Vector3D(hit.Position.X, hit.Position.Y, hit.Position.Z + 5f)); // impact effect (fix height)
projectile.Destroy();
WeaponDamage(hit, 1.10f, DamageType.Arcane);
};
projectile.Launch(TargetPosition, 1f);
yield break;
}
示例9: Main
public override IEnumerable<TickTimer> Main()
{
UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
var proj = new Projectile(this, RuneSelect(77604, 131664, 155092, 155749, 155938, 154674), User.Position);
if (Rune_C > 0)
{ proj.Position.Z += 3f; }
else
{ proj.Position.Z += 5f; }
proj.OnCollision = (hit) =>
{
hit.PlayEffectGroup(RuneSelect(154844, 155087, 154845, -1, 156007, 154846));
if (Rune_A > 0)
{
//cone damage in arch from user to target, from target's position "Thru its back"
TargetPosition = PowerMath.TranslateDirection2D(User.Position, hit.Position,
new Vector3D(User.Position.X, User.Position.Y, TargetPosition.Z),
35f);
//var FirstTarget = GetEnemiesInArcDirection(hit.Position, TargetPosition, ScriptFormula(13), ScriptFormula(14)).SortByDistanceFrom(User.Position);
//WeaponDamage(FirstTarget, ScriptFormula(0), DamageType.Cold);
//FirstTarget.PlayEffectGroup(131673);
WeaponDamage(hit, ScriptFormula(0), DamageType.Cold);
}
if (Rune_B > 0)
{
WeaponDamage(GetEnemiesInRadius(hit.Position, ScriptFormula(22)), ScriptFormula(0), DamageType.Lightning);
}
if (Rune_C > 0)
{
WeaponDamage(hit, ScriptFormula(0), DamageType.Physical);
if (Rand.NextDouble() < ScriptFormula(5))
{
AddBuff(hit, new FearedDebuff());
AddBuff(hit, new DebuffFeared(WaitSeconds(ScriptFormula(6))));
}
}
if (Rune_D > 0)
{
//radius damage to mobs, and heal user for 24% of damage
WeaponDamage(hit, ScriptFormula(0), DamageType.Poison);
}
if (Rune_E > 0)
{
WeaponDamage(hit, ScriptFormula(0), DamageType.Lightning);
//when critical hit, stun enemies -> AddBuff(hit, new DebuffStunned(WaitSeconds(ScriptFormula(38))));
}
else
WeaponDamage(hit, ScriptFormula(0), DamageType.Fire);
};
if (Rune_B > 0 || Rune_D > 0)
{ proj.Launch(TargetPosition, ScriptFormula(20)); }
else
proj.Launch(TargetPosition, ScriptFormula(1));
yield break;
}
示例10: Main
public override IEnumerable<TickTimer> Main()
{
User.TranslateFacing(TargetPosition);
//No more Resource Cost
if (Rune_A > 0)
{
var proj = new Projectile(this, 76019, User.Position);
proj.Position.Z += 5f; // fix height
proj.OnCollision = (hit) =>
{
hit.PlayEffectGroup(77858);
WeaponDamage(GetEnemiesInRadius(proj.Position, ScriptFormula(2)), ScriptFormula(0), DamageType.Lightning);
};
proj.Launch(TargetPosition, 1.25f);
}
else if (Rune_C > 0)
{
User.PlayEffectGroup(77807);
//unsure of the arc distances, but seems to be fine.
WeaponDamage(GetEnemiesInArcDirection(User.Position, TargetPosition, ScriptFormula(2), 90f), ScriptFormula(0), DamageType.Lightning);
}
else if (Target == null)
{
// no target, just zap the air with miss effect rope
User.AddRopeEffect(30913, TargetPosition);
}
else
{
IList<Actor> targets = new List<Actor>() { Target };
Actor ropeSource = User;
Actor curTarget = Target;
float damage = ScriptFormula(0);
while (targets.Count < ScriptFormula(9) + 1) // original target + bounce 2 times
{
// replace source with proxy if it died while doing bounce delay
if (ropeSource.World == null)
ropeSource = SpawnProxy(ropeSource.Position);
if (curTarget.World != null)
{
ropeSource.AddRopeEffect(0x78c0, curTarget);
ropeSource = curTarget;
AttackPayload attack = new AttackPayload(this);
attack.AddWeaponDamage(damage, DamageType.Lightning);
attack.Targets = new TargetList();
attack.Targets.Actors.Add(curTarget);
attack.Apply();
attack.OnHit = HitPayload =>
{
if (Rune_E > 0)
{
if (HitPayload.IsCriticalHit)
{
Vector3D[] projDestinations = PowerMath.GenerateSpreadPositions(User.Position, Target.Position, 72f, (int)ScriptFormula(14));
foreach (Vector3D missilePos in projDestinations)
{
var proj = new Projectile(this, 176247, Target.Position);
proj.OnCollision = (hit) =>
{
SpawnEffect(176262, new Vector3D(hit.Position.X, hit.Position.Y, hit.Position.Z + 5f)); // impact effect (fix height)
proj.Destroy();
WeaponDamage(hit, ScriptFormula(12), DamageType.Lightning);
};
proj.Launch(missilePos, 1.25f);
}
}
}
};
if (Rune_B > 0)
{
damage *= 0.7f;
}
if (Rune_D > 0)
{
GeneratePrimaryResource(ScriptFormula(6));
}
}
else
{
// early out if monster to be bounced died prematurely
break;
}
curTarget = GetEnemiesInRadius(curTarget.Position, ScriptFormula(2), (int)ScriptFormula(9)).Actors.FirstOrDefault(t => !targets.Contains(t));
if (curTarget != null)
{
targets.Add(curTarget);
yield return WaitSeconds(0.150f);
}
else
{
break;
}
}
}
//.........这里部分代码省略.........