private void TryInitialize() { this.flashesMesh.ClearGroups(); this.bombStates.Clear(); this.indexedDg.Clear(); this.destructibleGroups.Clear(); foreach (TrileGroup trileGroup in (IEnumerable <TrileGroup>) this.LevelManager.Groups.Values) { if (trileGroup.Triles.Count != 0 && ActorTypeExtensions.IsDestructible(trileGroup.Triles[0].Trile.ActorSettings.Type) && ActorTypeExtensions.IsDestructible(trileGroup.Triles[trileGroup.Triles.Count - 1].Trile.ActorSettings.Type)) { BombsHost.DestructibleGroup destructibleGroup = new BombsHost.DestructibleGroup() { AllTriles = new List <TrileInstance>((IEnumerable <TrileInstance>)trileGroup.Triles), Group = trileGroup }; this.destructibleGroups.Add(destructibleGroup); FaceOrientation face = FaceOrientation.Down; foreach (TrileInstance key in trileGroup.Triles) { this.indexedDg.Add(key, destructibleGroup); TrileEmplacement traversal = key.Emplacement.GetTraversal(ref face); TrileInstance instance = this.LevelManager.TrileInstanceAt(ref traversal); if (instance != null && !ActorTypeExtensions.IsDestructible(instance.Trile.ActorSettings.Type) && instance.PhysicsState == null) { instance.PhysicsState = new InstancePhysicsState(instance); } } } } }
private bool TryExplodeAt(BombsHost.BombState state, TrileInstance nearestNeighbor, ref bool chainsploded, ref bool needsRecull) { if (nearestNeighbor != null && nearestNeighbor.Enabled && !nearestNeighbor.Trile.Immaterial) { if (!ActorTypeExtensions.IsChainsploding(nearestNeighbor.Trile.ActorSettings.Type) && !ActorTypeExtensions.IsDestructible(nearestNeighbor.Trile.ActorSettings.Type)) { return(true); } if (!this.bombStates.ContainsKey(nearestNeighbor)) { if (ActorTypeExtensions.IsBomb(nearestNeighbor.Trile.ActorSettings.Type)) { nearestNeighbor.PhysicsState.Respawned = false; } if (!chainsploded) { this.bsToAdd.Add(new KeyValuePair <TrileInstance, BombsHost.BombState>(nearestNeighbor, new BombsHost.BombState() { SincePickup = state.SincePickup - this.ChainsplodeDelay, IsChainsploding = true, ChainsplodedBy = state })); chainsploded = true; } else { this.ClearDestructible(nearestNeighbor, true); this.LevelMaterializer.CullInstanceOut(nearestNeighbor); this.DropSupportedTriles(nearestNeighbor); needsRecull = true; } return(true); } } return(false); }