Cloak Changes: appear semitransparent to localplayer, not at all to others. Same for mines.

( Also fix compile warning in LimitedAmmo )
This commit is contained in:
alzeih
2010-07-24 15:17:29 +12:00
parent 5375692f1f
commit 4fd5d9e0c3
3 changed files with 25 additions and 7 deletions

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
namespace OpenRA.Traits
{
@@ -24,7 +25,7 @@ namespace OpenRA.Traits
public object Create(ActorInitializer init) { return new Cloak(init.self); }
}
public class Cloak : IRenderModifier, INotifyAttack, ITick, INotifyDamage, IRadarVisibilityModifier
public class Cloak : IRenderModifier, INotifyAttack, ITick, INotifyDamage, IRadarVisibilityModifier, IRadarColorModifier
{
[Sync]
int remainingTime;
@@ -76,7 +77,7 @@ namespace OpenRA.Traits
Sound.Play(self.Info.Traits.Get<CloakInfo>().CloakSound, self.CenterLocation);
}
public bool Cloaked { get { return remainingTime > 0; } }
public bool Cloaked { get { return remainingTime == 0; } }
public bool VisibleOnRadar(Actor self)
@@ -84,6 +85,14 @@ namespace OpenRA.Traits
return !Cloaked || self.Owner == self.World.LocalPlayer;
}
public Color RadarColorOverride(Actor self)
{
var c = self.Owner.Color;
if (self.Owner == self.World.LocalPlayer && Cloaked)
c = Color.FromArgb(128, c);
return c;
}
public void Decloak(int time)
{
DoSurface();