public void Dispose() { if (Layers != null) { foreach (var layer in Layers) { if (layer.Value != null) { layer.Value.Dispose(); } } } if (LBranch != null) { LBranchSprite.Dispose(); } LBranch = null; if (Layers != null) { Layers.Clear(); } if (Lights != null) { Lights.Clear(); } }
public void LayersUpdate(int pos, int FWidthHalf) { var timenow = DateTime.Now; if ((timenow - Begin).TotalSeconds > 3) { var randpos = LRand.Next(pos - FWidthHalf, pos + FWidthHalf); LBranch = new LightningBranch(new Vector2(randpos, Limits.Y), new Vector2(randpos, Limits.Height), LBranchSprite); Begin = timenow; } if (LBranch != null) { LBranch.Update(); } }
public void Initialize(string levelName, LoadManager loader) { var LoadedPack = loader.LoadLevel(levelName, ServiceLocator.Instance.GraphDev); this.Limits = LoadedPack.Item4; this.Lights = LoadedPack.Item3; this.Layers = LoadedPack.Item2; foreach (var layer in Layers) { layer.Value.Texture = LoadedPack.Item1[layer.Value.State]; layer.Value.Camera.Limits = this.Limits; } this.LBranchSprite = Layers[LevelState.BACKGROUND].Texture; this.LBranch = new LightningBranch(new Vector2(100, Limits.Y), new Vector2(100, Limits.Height), LBranchSprite); this.Begin = DateTime.Now; }