public void DestroyEntity(Guid id) { Entity removal = this.Entities.Where(x => x.Id == id).FirstOrDefault(); if (removal != null) { Entities.Remove(removal); PositionComponents.Remove(id); VelocityComponents.Remove(id); DisplayComponents.Remove(id); HealthComponents.Remove(id); AnimationComponents.Remove(id); SightRadiusComponents.Remove(id); LabelComponents.Remove(id); } }
public void DestroyEntity(Guid id) { Entity removal = this.Entities.Where(x => x.Id == id).FirstOrDefault(); if (removal != null) { Entities.Remove(removal); PositionComponents.Remove(id); VelocityComponents.Remove(id); DisplayComponents.Remove(id); AnimationComponents.Remove(id); SightRadiusComponents.Remove(id); LabelComponents.Remove(id); SkillLevelsComponents.Remove(id); TargetPositionComponents.Remove(id); DirectionComponents.Remove(id); TimeToLiveComponents.Remove(id); CollisionComponents.Remove(id); NameComponents.Remove(id); AICombatComponents.Remove(id); AIAlignmentComponents.Remove(id); AIStateComponents.Remove(id); AIFieldOfViewComponents.Remove(id); AISleepComponents.Remove(id); AIRoamComponents.Remove(id); AIFleeComponents.Remove(id); InputMovementComponents.Remove(id); EntityMessageComponents.Remove(id); AlternateFOVColorChangeComponents.Remove(id); HealthRegenerationComponents.Remove(id); OutlineComponents.Remove(id); SecondaryOutlineComponents.Remove(id); InventoryComponents.Remove(id); PickupComponents.Remove(id); StatModificationComponents.Remove(id); ValueComponents.Remove(id); ItemFunctionsComponents.Remove(id); PassivesComponents.Remove(id); ArtifactStatsComponents.Remove(id); BurningComponents.Remove(id); } }
public void Clean(Game game) { foreach (var component in LevelComponents.Where(b => b.GameId == game.Id)) { LevelComponents.Remove(component); } foreach (var branch in Branches.Where(b => b.GameId == game.Id)) { Branches.Remove(branch); } foreach (var logEntry in LogEntries.Where(e => e.GameId == game.Id)) { LogEntries.Remove(logEntry); } foreach (var playerCommand in PlayerCommands.Where(b => b.GameId == game.Id)) { PlayerCommands.Remove(playerCommand); } foreach (var abilityComponent in AbilityComponents.Where(b => b.GameId == game.Id)) { AbilityComponents.Remove(abilityComponent); } foreach (var aiComponent in AIComponents.Where(b => b.GameId == game.Id)) { AIComponents.Remove(aiComponent); } foreach (var playerComponent in PlayerComponents.Where(b => b.GameId == game.Id)) { PlayerComponents.Remove(playerComponent); } foreach (var beingComponent in BeingComponents.Where(b => b.GameId == game.Id)) { BeingComponents.Remove(beingComponent); } foreach (var physicalComponent in PhysicalComponents.Where(b => b.GameId == game.Id)) { PhysicalComponents.Remove(physicalComponent); } foreach (var raceComponent in RaceComponents.Where(b => b.GameId == game.Id)) { RaceComponents.Remove(raceComponent); } foreach (var effectComponent in EffectComponents.Where(b => b.GameId == game.Id)) { EffectComponents.Remove(effectComponent); } foreach (var itemComponent in ItemComponents.Where(b => b.GameId == game.Id)) { ItemComponents.Remove(itemComponent); } foreach (var knowledgeComponent in KnowledgeComponents.Where(b => b.GameId == game.Id)) { KnowledgeComponents.Remove(knowledgeComponent); } foreach (var connectionComponent in ConnectionComponents.Where(b => b.GameId == game.Id)) { ConnectionComponents.Remove(connectionComponent); } foreach (var positionComponent in PositionComponents.Where(b => b.GameId == game.Id)) { PositionComponents.Remove(positionComponent); } foreach (var sensorComponent in SensorComponents.Where(b => b.GameId == game.Id)) { SensorComponents.Remove(sensorComponent); } game.ActingPlayerId = null; SaveChanges(); Games.Remove(game); SaveChanges(); }