synced group creation

This commit is contained in:
Chris Forbes
2010-05-16 12:08:37 +12:00
parent b871caa287
commit c20a1cc70a
4 changed files with 46 additions and 1 deletions

36
OpenRA.Game/Group.cs Normal file
View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRA
{
public class Group
{
List<Actor> actors;
int id;
static int nextGroup;
public IEnumerable<Actor> Actors { get { return actors; } }
public Group(IEnumerable<Actor> actors)
{
this.actors = actors.ToList();
foreach (var a in actors)
a.Group = this;
id = nextGroup++;
}
public void Dump()
{
/* debug crap */
Game.Debug("Group #{0}: {1}".F(
id, string.Join(",", actors.Select(a => "#{0} {1}".F(a.ActorID, a.Info.Name)).ToArray())));
}
/* todo: add lazy group path crap, groupleader, pruning, etc */
}
}