SpawnMapActors trait on world actor is now responsible for spawning trees etc at gamestart time

This commit is contained in:
Chris Forbes
2010-03-17 19:31:19 +13:00
parent 79ce49dd77
commit 79bcb3c739
5 changed files with 27 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRA.Traits
{
class SpawnMapActorsInfo : StatelessTraitInfo<SpawnMapActors> { }
class SpawnMapActors : IGameStarted
{
public void GameStarted(World world)
{
Game.skipMakeAnims = true; // rude hack
foreach (var actorReference in world.Map.Actors)
world.CreateActor(actorReference.Name, actorReference.Location,
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Owner)
?? world.NeutralPlayer);
Game.skipMakeAnims = false;
}
}
}