Set the viewport on world load

This commit is contained in:
Paul Chote
2010-04-09 23:41:43 +12:00
committed by Chris Forbes
parent 803076caf9
commit 0047b961b3
3 changed files with 18 additions and 14 deletions

View File

@@ -29,16 +29,19 @@ namespace OpenRA.Mods.RA
public object Create(Actor self) { return new DefaultShellmapScript(); }
}
class DefaultShellmapScript : ITick
class DefaultShellmapScript : ITick, ILoadWorldHook
{
public void WorldLoaded(World w)
{
// Set the viewport location
Game.MoveViewport(new int2(85,65));
}
// Rude hack around the multiple-creation bug:
// wait long enough for the transient copies to die before starting
int initialDelay = 20;
public void Tick(Actor self)
{
// Another rude hack
Game.MoveViewport(new int2(85,65));
if (initialDelay > 0 && --initialDelay == 0)
Sound.PlayMusic("hell226m.aud");
}