GetCollection() private method

private GetCollection ( CollectionType t ) : CNCMaps.Engine.Game.GameCollection
t CollectionType
return CNCMaps.Engine.Game.GameCollection
Beispiel #1
0
        private void RemoveUnknownObjects()
        {
            var c = _theater.GetCollection(CollectionType.Terrain);

            foreach (var obj in _terrainObjects.Where(obj => !c.HasObject(obj)).ToList())
            {
                _terrainObjects.Remove(obj);
                obj.Tile.RemoveObject(obj);
            }

            c = _theater.GetCollection(CollectionType.Infantry);
            foreach (var obj in _infantryObjects.Where(obj => !c.HasObject(obj)).ToList())
            {
                obj.Tile.RemoveObject(obj);
                _infantryObjects.Remove(obj);
            }

            c = _theater.GetCollection(CollectionType.Vehicle);
            foreach (var obj in _unitObjects.Where(obj => !c.HasObject(obj)).ToList())
            {
                obj.Tile.RemoveObject(obj);
                _unitObjects.Remove(obj);
            }

            c = _theater.GetCollection(CollectionType.Aircraft);
            foreach (var obj in _aircraftObjects.Where(obj => !c.HasObject(obj)).ToList())
            {
                obj.Tile.RemoveObject(obj);
                _aircraftObjects.Remove(obj);
            }

            c = _theater.GetCollection(CollectionType.Smudge);
            foreach (var obj in _smudgeObjects.Where(obj => !c.HasObject(obj)).ToList())
            {
                obj.Tile.RemoveObject(obj);
                _smudgeObjects.Remove(obj);
            }


            c = _theater.GetCollection(CollectionType.Building);
            var cAlt = _theater.GetCollection(CollectionType.Overlay);

            foreach (var obj in _structureObjects.Where(obj => !c.HasObject(obj) && !cAlt.HasObject(obj)).ToList())
            {
                obj.Tile.RemoveObject(obj);
                _structureObjects.Remove(obj);
            }
        }