gpsdot has sprites

This commit is contained in:
Chris Forbes
2011-05-02 19:51:15 +12:00
parent 25962d58c6
commit dd4c5508fa
4 changed files with 34 additions and 14 deletions

View File

@@ -12,29 +12,33 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Graphics;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.RA.Effects
{ {
class GpsDotInfo : ITraitInfo class GpsDotInfo : ITraitInfo
{ {
public readonly string String = "o"; public readonly string String = "Infantry";
public object Create(ActorInitializer init) public object Create(ActorInitializer init)
{ {
return new GpsDot(init, String); return new GpsDot(init, String);
} }
} }
class GpsDot : IEffect class GpsDot : IEffect
{ {
string s;
int2 loc; int2 loc;
Color color; Color color;
Actor self; Actor self;
GpsWatcher watcher; GpsWatcher watcher;
bool show = false; bool show = false;
Animation anim;
public GpsDot(ActorInitializer init, string s) public GpsDot(ActorInitializer init, string s)
{ {
this.s = s; anim = new Animation("gpsdot");
anim.PlayRepeating(s);
self = init.self; self = init.self;
loc = self.CenterLocation; loc = self.CenterLocation;
color = self.Owner.ColorRamp.GetColor(0); color = self.Owner.ColorRamp.GetColor(0);
@@ -68,8 +72,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<Renderable> Render() public IEnumerable<Renderable> Render()
{ {
if (show) if (show)
Game.Renderer.TinyBoldFont.DrawTextWithContrast(s, loc - Game.viewport.Location, color, Color.Black, 1); yield return Traits.Util.Centered(self, anim.Image, self.CenterLocation.ToFloat2());
yield break;
} }
} }
} }

View File

@@ -179,7 +179,7 @@ YAK:
TRAN: TRAN:
Inherits: ^Plane Inherits: ^Helicopter
Buildable: Buildable:
Queue: Plane Queue: Plane
BuildPaletteOrder: 110 BuildPaletteOrder: 110
@@ -218,7 +218,7 @@ TRAN:
Explosion: UnitExplode Explosion: UnitExplode
HELI: HELI:
Inherits: ^Plane Inherits: ^Helicopter
Buildable: Buildable:
Queue: Plane Queue: Plane
BuildPaletteOrder: 90 BuildPaletteOrder: 90
@@ -262,7 +262,7 @@ HELI:
Offset: 0,-10 Offset: 0,-10
HIND: HIND:
Inherits: ^Plane Inherits: ^Helicopter
Buildable: Buildable:
Queue: Plane Queue: Plane
BuildPaletteOrder: 90 BuildPaletteOrder: 90

View File

@@ -29,7 +29,7 @@
Types:Vehicle Types:Vehicle
GivesBounty: GivesBounty:
GpsDot: GpsDot:
String:O String:Vehicle
^Tank: ^Tank:
AppearsOnRadar: AppearsOnRadar:
@@ -62,7 +62,7 @@
Types:Tank Types:Tank
GivesBounty: GivesBounty:
GpsDot: GpsDot:
String:O String:Vehicle
^Infantry: ^Infantry:
AppearsOnRadar: AppearsOnRadar:
@@ -101,7 +101,7 @@
Types:Infantry Types:Infantry
GivesBounty: GivesBounty:
GpsDot: GpsDot:
String:o String:Infantry
^Ship: ^Ship:
AppearsOnRadar: AppearsOnRadar:
@@ -126,7 +126,7 @@
Types:Ship Types:Ship
GivesBounty: GivesBounty:
GpsDot: GpsDot:
String:O String:Ship
^Plane: ^Plane:
AppearsOnRadar: AppearsOnRadar:
@@ -153,7 +153,11 @@
SuccessRate: 50 SuccessRate: 50
GivesBounty: GivesBounty:
GpsDot: GpsDot:
String:O String:Plane
^Helicopter:
GpsDot:
String:Helicopter
^Building: ^Building:
AppearsOnRadar: AppearsOnRadar:

View File

@@ -1917,3 +1917,16 @@ boxes09:
idle: idle:
Start: 0 Start: 0
Length: * Length: *
gpsdot:
Infantry:
Start: 0
Vehicle:
Start: 1
Ship:
Start: 2
Helicopter:
Start: 3
Plane:
Start: 4