Use in parameter for Target
This commit is contained in:
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
|
||||
public readonly WDist Range = WDist.FromCells(1);
|
||||
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
var firedBy = args.SourceActor;
|
||||
var actors = target.Type == TargetType.Actor ? new[] { target.Actor } :
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
if (target.Type == TargetType.Invalid)
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
}
|
||||
|
||||
// TODO: Allow maximum resource splatter to be defined. (Per tile, and in total).
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
if (target.Type == TargetType.Invalid)
|
||||
return;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
return base.IsValidAgainst(victim, firedBy);
|
||||
}
|
||||
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
var firedBy = args.SourceActor;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
public readonly int[] Size = { 0, 0 };
|
||||
|
||||
// TODO: Allow maximum resource removal to be defined. (Per tile, and in total).
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
if (target.Type == TargetType.Invalid)
|
||||
return;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
throw new YamlException("Weapons Ruleset does not contain an entry '{0}'".F(Weapon.ToLowerInvariant()));
|
||||
}
|
||||
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
if (target.Type == TargetType.Invalid)
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
[Desc("Duration of the flashing, measured in ticks. Set to -1 to default to the `Length` of the `FlashPaletteEffect`.")]
|
||||
public readonly int Duration = 0;
|
||||
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
foreach (var flash in args.SourceActor.World.WorldActor.TraitsImplementing<FlashPaletteEffect>())
|
||||
if (flash.Info.Type == FlashType)
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
|
||||
public readonly WDist Range = WDist.FromCells(1);
|
||||
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
var firedBy = args.SourceActor;
|
||||
var actors = target.Type == TargetType.Actor ? new[] { target.Actor } :
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
[Desc("Percentual chance the smudge is created.")]
|
||||
public readonly int Chance = 100;
|
||||
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
if (target.Type == TargetType.Invalid)
|
||||
return;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
[Desc("Shake multipliers by the X and Y axis, comma-separated.")]
|
||||
public readonly float2 Multiplier = new float2(0, 0);
|
||||
|
||||
public override void DoImpact(Target target, WarheadArgs args)
|
||||
public override void DoImpact(in Target target, WarheadArgs args)
|
||||
{
|
||||
args.SourceActor.World.WorldActor.Trait<ScreenShaker>().AddEffect(Duration, target.CenterPosition, Intensity, Multiplier);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
}
|
||||
|
||||
/// <summary>Applies the warhead's effect against the target.</summary>
|
||||
public abstract void DoImpact(Target target, WarheadArgs args);
|
||||
public abstract void DoImpact(in Target target, WarheadArgs args);
|
||||
|
||||
/// <summary>Checks if the warhead is valid against (can do something to) the actor.</summary>
|
||||
public virtual bool IsValidAgainst(Actor victim, Actor firedBy)
|
||||
|
||||
Reference in New Issue
Block a user