コード例 #1
0
ファイル: Arena.cs プロジェクト: vvnurmi/assaultwing
 /// <summary>
 /// This constructor is only for serialisation.
 /// </summary>
 public Arena()
 {
     Info = new ArenaInfo { Name = (CanonicalString)"dummyarena", Dimensions = new Vector2(4000, 4000) };
     _layers = new List<ArenaLayer>();
     _layers.Add(new ArenaLayer());
     Gobs = new GobCollection(_layers);
     Bin = new ArenaBin();
     _gravity = new Vector2(0, -30);
     _lighting = new LightingSettings();
     _backgroundMusic = new BackgroundMusic();
 }
コード例 #2
0
ファイル: Arena.cs プロジェクト: vvnurmi/assaultwing
 /// <summary>
 /// Initialises the gobs that are initially contained in the arena for playing the arena.
 /// </summary>
 /// This is done by taking copies of all the gobs. In effect, this turns deserialised
 /// gobs into properly initialised gobs. Namely, deserialised gobs are created by 
 /// the parameterless constructor that doesn't properly initialise all fields.
 private void InitializeGobs()
 {
     InitializeSpecialLayers();
     var oldLayers = _layers;
     _layers = new List<ArenaLayer>();
     foreach (var layer in oldLayers)
     {
         layer.Gobs.FinishAddsAndRemoves();
         _layers.Add(layer.EmptyCopy());
         foreach (var gob in layer.Gobs)
             gob.Layer = layer;
     }
     for (int layerIndex = 0; layerIndex < _layers.Count; layerIndex++) _layers[layerIndex].Index = layerIndex;
     Gobs = new GobCollection(_layers);
     InitializeSpecialLayers();
     foreach (var gob in new GobCollection(oldLayers))
         Gob.CreateGob(Game, gob, gobb =>
         {
             gobb.Layer = _layers[oldLayers.IndexOf(gob.Layer)];
             Gobs.Add(gobb);
         });
     Gobs.FinishAddsAndRemoves();
 }
コード例 #3
0
ファイル: Arena.cs プロジェクト: vvnurmi/assaultwing
 public void MakeConsistent(Type limitationAttribute)
 {
     Gobs = new GobCollection(Layers);
     Gobs.FinishAddsAndRemoves();
     if (limitationAttribute == typeof(TypeParameterAttribute))
     {
         SetGameAndArenaToGobs();
     }
 }