Actor properties consistency improved

This commit is contained in:
huwpascoe
2014-11-10 14:20:19 +00:00
parent 6a425b8636
commit a660bb95b5
58 changed files with 109 additions and 120 deletions

View File

@@ -98,7 +98,7 @@ namespace OpenRA.Traits
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
nd.DamageStateChanged(self, ai);
if (Info.NotifyAppliedDamage && repairer != null && repairer.IsInWorld && !repairer.IsDead())
if (Info.NotifyAppliedDamage && repairer != null && repairer.IsInWorld && !repairer.IsDead)
foreach (var nd in repairer.TraitsImplementing<INotifyAppliedDamage>()
.Concat(repairer.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
nd.AppliedDamage(repairer, self, ai);
@@ -141,7 +141,7 @@ namespace OpenRA.Traits
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
nd.DamageStateChanged(self, ai);
if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead())
if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead)
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
nd.AppliedDamage(attacker, self, ai);

View File

@@ -47,13 +47,13 @@ namespace OpenRA.Traits
FootprintRegion = footprintRegion;
CenterPosition = self.CenterPosition;
Bounds = self.Bounds.Value;
Bounds = self.Bounds;
}
public uint ID { get { return actor.ActorID; } }
public bool IsValid { get { return Owner != null && HasRenderables; } }
public ActorInfo Info { get { return actor.Info; } }
public Actor Actor { get { return !actor.IsDead() ? actor : null; } }
public Actor Actor { get { return !actor.IsDead ? actor : null; } }
int flashTicks;
public void Tick(World world, Shroud shroud)

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Traits
IEnumerable<WPos> ActivityTargetPath()
{
if (!self.IsInWorld || self.IsDead())
if (!self.IsInWorld || self.IsDead)
yield break;
var activity = self.GetCurrentActivity();

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Traits
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) && self.World.FogObscures(self))
yield break;
var b = self.Bounds.Value;
var b = self.Bounds;
var pos = wr.ScreenPxPosition(self.CenterPosition);
var tl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Top));
var bl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Bottom));
@@ -85,7 +85,7 @@ namespace OpenRA.Traits
var pipxyBase = basePosition + new int2(1 - pipSize.X / 2, - (3 + pipSize.Y / 2));
var pipxyOffset = new int2(0, 0);
var pal = wr.Palette(Info.Palette);
var width = self.Bounds.Value.Width;
var width = self.Bounds.Width;
foreach (var pips in pipSources)
{

View File

@@ -66,7 +66,7 @@ namespace OpenRA.Traits
if (type == TargetType.Actor)
{
// Actor is no longer in the world
if (!actor.IsInWorld || actor.IsDead())
if (!actor.IsInWorld || actor.IsDead)
return TargetType.Invalid;
// Actor generation has changed (teleported or captured)

View File

@@ -84,7 +84,7 @@ namespace OpenRA.Traits
public void Add(Actor a)
{
var pos = worldRenderer.ScreenPxPosition(a.CenterPosition);
var bounds = a.Bounds.Value;
var bounds = a.Bounds;
bounds.Offset(pos.X, pos.Y);
var top = Math.Max(0, bounds.Top / info.BinSize);