本文整理汇总了C#中OpenRA.GameRules.ProjectileArgs类的典型用法代码示例。如果您正苦于以下问题:C# ProjectileArgs类的具体用法?C# ProjectileArgs怎么用?C# ProjectileArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectileArgs类属于OpenRA.GameRules命名空间,在下文中一共展示了ProjectileArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tick
public void Tick(Actor self)
{
if (!target.IsInRange(self.CenterPosition, range))
return;
var limitedAmmo = self.TraitOrDefault<LimitedAmmo>();
if (limitedAmmo != null && !limitedAmmo.HasAmmo())
return;
if (--dropDelay <= 0)
{
var weapon = Rules.Weapons[info.Weapon.ToLowerInvariant()];
dropDelay = weapon.ROF;
var pos = self.CenterPosition;
var args = new ProjectileArgs
{
Weapon = weapon,
Facing = self.Trait<IFacing>().Facing,
Source = pos,
SourceActor = self,
PassiveTarget = pos - new WVec(0, 0, pos.Z)
};
self.World.Add(args.Weapon.Projectile.Create(args));
if (args.Weapon.Report != null && args.Weapon.Report.Any())
Sound.Play(args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
}
}
示例2: AreaBeam
public AreaBeam(AreaBeamInfo info, ProjectileArgs args, Color color)
{
this.info = info;
this.args = args;
this.color = color;
actorAttackBase = args.SourceActor.Trait<AttackBase>();
var world = args.SourceActor.World;
if (info.Speed.Length > 1)
speed = new WDist(world.SharedRandom.Next(info.Speed[0].Length, info.Speed[1].Length));
else
speed = info.Speed[0];
// Both the head and tail start at the source actor, but initially only the head is travelling.
headPos = args.Source;
tailPos = headPos;
target = args.PassiveTarget;
if (info.Inaccuracy.Length > 0)
{
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
var maxOffset = inaccuracy * (target - headPos).Length / args.Weapon.Range.Length;
target += WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024;
}
towardsTargetFacing = (target - headPos).Yaw.Facing;
// Update the target position with the range we shoot beyond the target by
// I.e. we can deliberately overshoot, so aim for that position
var dir = new WVec(0, -1024, 0).Rotate(WRot.FromFacing(towardsTargetFacing));
target += dir * info.BeyondTargetRange.Length / 1024;
length = Math.Max((target - headPos).Length / speed.Length, 1);
}
示例3: Missile
public Missile(MissileInfo info, ProjectileArgs args)
{
this.info = info;
this.args = args;
pos = args.Source;
facing = args.Facing;
targetPosition = args.PassiveTarget;
var world = args.SourceActor.World;
if (world.SharedRandom.Next(100) <= info.LockOnProbability)
lockOn = true;
if (info.Inaccuracy.Range > 0)
{
var inaccuracy = OpenRA.Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Range, args.InaccuracyModifiers);
offset = WVec.FromPDF(world.SharedRandom, 2) * inaccuracy / 1024;
}
if (info.Image != null)
{
anim = new Animation(world, info.Image, () => facing);
anim.PlayRepeating("idle");
}
if (info.ContrailLength > 0)
{
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
trail = new ContrailRenderable(world, color, info.ContrailLength, info.ContrailDelay, 0);
}
}
示例4: Missile
public Missile(MissileInfo info, ProjectileArgs args)
{
this.info = info;
this.args = args;
pos = args.Source;
facing = args.Facing;
targetPosition = args.PassiveTarget;
if (info.Inaccuracy.Range > 0)
offset = WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * info.Inaccuracy.Range / 1024;
if (info.Image != null)
{
anim = new Animation(args.SourceActor.World, info.Image, () => facing);
anim.PlayRepeating("idle");
}
if (info.ContrailLength > 0)
{
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
trail = new ContrailRenderable(args.SourceActor.World, color, info.ContrailLength, info.ContrailDelay, 0);
}
}
示例5: Bullet
public Bullet(BulletInfo info, ProjectileArgs args)
{
Info = info;
Args = args;
if (info.Inaccuracy > 0)
{
var factor = ((Args.dest - Args.src).ToCVec().Length) / args.weapon.Range;
Args.dest += (PVecInt) (info.Inaccuracy * factor * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2();
Log.Write("debug", "Bullet with Inaccuracy; factor: #{0}; Projectile dest: {1}", factor, Args.dest);
}
if (Info.Image != null)
{
anim = new Animation(Info.Image, GetEffectiveFacing);
anim.PlayRepeating("idle");
}
if (Info.ContrailLength > 0)
{
Trail = new ContrailHistory(Info.ContrailLength,
Info.ContrailUsePlayerColor ? ContrailHistory.ChooseColor(args.firedBy) : Info.ContrailColor,
Info.ContrailDelay);
}
}
示例6: Missile
public Missile(MissileInfo info, ProjectileArgs args)
{
this.info = info;
this.args = args;
pos = args.Source;
facing = args.Facing;
targetPosition = args.PassiveTarget;
// Convert ProjectileArg definitions to world coordinates
// TODO: Change the yaml definitions so we don't need this
var inaccuracy = (int)(info.Inaccuracy * 1024 / Game.CellSize);
speed = info.Speed * 1024 / (5 * Game.CellSize);
if (info.Inaccuracy > 0)
offset = WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * inaccuracy / 1024;
if (info.Image != null)
{
anim = new Animation(info.Image, () => facing);
anim.PlayRepeating("idle");
}
if (info.ContrailLength > 0)
{
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
trail = new ContrailRenderable(args.SourceActor.World, color, info.ContrailLength, info.ContrailDelay, 0);
}
}
示例7: Missile
public Missile(MissileInfo info, ProjectileArgs args)
{
Info = info;
Args = args;
SubPxPosition = 1024 * Args.src;
Altitude = Args.srcAltitude;
Facing = Args.facing;
if (info.Inaccuracy > 0)
offset = (info.Inaccuracy * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2();
if (Info.Image != null)
{
anim = new Animation(Info.Image, () => Facing);
anim.PlayRepeating("idle");
}
if (Info.ContrailLength > 0)
{
Trail = new ContrailHistory(Info.ContrailLength,
Info.ContrailUsePlayerColor ? ContrailHistory.ChooseColor(args.firedBy) : Info.ContrailColor,
Info.ContrailDelay);
}
}
示例8: TeslaZap
int timeUntilRemove = 2; // # of frames
#endregion Fields
#region Constructors
public TeslaZap(TeslaZapInfo info, ProjectileArgs args)
{
Args = args;
var bright = SequenceProvider.GetSequence("litning", "bright");
var dim = SequenceProvider.GetSequence("litning", "dim");
for (var n = 0; n < numZaps; n++)
renderables.AddRange(DrawZapWandering(args.src, args.dest, n == numZaps - 1 ? bright : dim));
}
示例9: LaserZap
public LaserZap(ProjectileArgs args, LaserZapInfo info, Color color)
{
this.args = args;
this.info = info;
this.color = color;
if (info.Explosion != null)
this.explosion = new Animation(info.Explosion);
}
示例10: LaserZap
public LaserZap(ProjectileArgs args, LaserZapInfo info, Color color)
{
this.args = args;
this.info = info;
this.color = color;
this.target = args.PassiveTarget;
if (!string.IsNullOrEmpty(info.HitAnim))
this.hitanim = new Animation(args.SourceActor.World, info.HitAnim);
}
示例11: LaserZap
public LaserZap(ProjectileArgs args, LaserZapInfo info, Color color)
{
this.args = args;
this.info = info;
this.color = color;
this.target = args.PassiveTarget;
if (info.HitAnim != null)
this.hitanim = new Animation(info.HitAnim);
}
示例12: GravityBomb
public GravityBomb(GravityBombInfo info, ProjectileArgs args)
{
Args = args;
altitude = args.srcAltitude;
anim = new Animation(info.Image);
if (anim.HasSequence("open"))
anim.PlayThen("open", () => anim.PlayRepeating("idle"));
else
anim.PlayRepeating("idle");
}
示例13: TeslaZap
int timeUntilRemove = 2; // # of frames
#endregion Fields
#region Constructors
public TeslaZap(TeslaZapInfo info, ProjectileArgs args)
{
Args = args;
var bright = SequenceProvider.GetSequence(info.Image, "bright");
var dim = SequenceProvider.GetSequence(info.Image, "dim");
for( var n = 0; n < info.DimZaps; n++ )
renderables.AddRange(DrawZapWandering(args.src, args.dest, dim));
for( var n = 0; n < info.BrightZaps; n++ )
renderables.AddRange(DrawZapWandering(args.src, args.dest, bright));
}
示例14: GravityBomb
public GravityBomb(GravityBombInfo info, ProjectileArgs args)
{
this.info = info;
this.args = args;
pos = args.Source;
velocity = new WVec(WRange.Zero, WRange.Zero, -info.Velocity);
anim = new Animation(info.Image);
if (anim.HasSequence("open"))
anim.PlayThen("open", () => anim.PlayRepeating("idle"));
else
anim.PlayRepeating("idle");
}
示例15: Missile
public Missile(MissileInfo info, ProjectileArgs args)
{
this.info = info;
this.args = args;
pos = args.Source;
hFacing = args.Facing;
gravity = new WVec(0, 0, -info.Gravity);
targetPosition = args.PassiveTarget;
rangeLimit = info.RangeLimit != WDist.Zero ? info.RangeLimit : args.Weapon.Range;
minLaunchSpeed = info.MinimumLaunchSpeed.Length > -1 ? info.MinimumLaunchSpeed.Length : info.Speed.Length;
maxLaunchSpeed = info.MaximumLaunchSpeed.Length > -1 ? info.MaximumLaunchSpeed.Length : info.Speed.Length;
maxSpeed = info.Speed.Length;
minLaunchAngle = info.MinimumLaunchAngle;
maxLaunchAngle = info.MaximumLaunchAngle;
var world = args.SourceActor.World;
if (info.Inaccuracy.Length > 0)
{
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
offset = WVec.FromPDF(world.SharedRandom, 2) * inaccuracy / 1024;
}
DetermineLaunchSpeedAndAngle(world, out speed, out vFacing);
velocity = new WVec(0, -speed, 0)
.Rotate(new WRot(WAngle.FromFacing(vFacing), WAngle.Zero, WAngle.Zero))
.Rotate(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(hFacing)));
if (world.SharedRandom.Next(100) <= info.LockOnProbability)
lockOn = true;
if (!string.IsNullOrEmpty(info.Image))
{
anim = new Animation(world, info.Image, () => renderFacing);
anim.PlayRepeating(info.Sequences.Random(world.SharedRandom));
}
if (info.ContrailLength > 0)
{
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
contrail = new ContrailRenderable(world, color, info.ContrailWidth, info.ContrailLength, info.ContrailDelay, info.ContrailZOffset);
}
trailPalette = info.TrailPalette;
if (info.TrailUsePlayerPalette)
trailPalette += args.SourceActor.Owner.InternalName;
}