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

View File

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

View File

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

View File

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