public void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera) { if (RootComponent != null) { RootComponent.UpdateTransformsRecursive(); } Factions.Update(gameTime); foreach (GameComponent component in Components.Values) { if (component.IsActive) { component.Update(gameTime, chunks, camera); } if (component.IsDead) { Removals.Add(component); component.IsActive = false; component.IsDead = true; component.IsVisible = false; } } HandleAddRemoves(); }
public void Update(string newDirectory) { var filePath = Path.Combine(newDirectory, Name); var newLines = new List <string>(); foreach (var line in File.ReadLines(filePath)) { var newLine = line; if (Removals.Any(r => newLine.Contains(r)) && !RemovalsToSkip.Any(s => newLine.Contains(s))) { continue; } foreach (var replacement in Replacements) { if (newLine.Contains(replacement.Key)) { newLine = newLine.Replace(replacement.Key, replacement.Value); } } newLines.Add(newLine); } File.WriteAllLines(filePath, newLines); }
private void AddRemove() { DataLock.WaitOne(); foreach (InstanceData t in Additions) { Data.Add(t); } foreach (InstanceData t in Removals) { Data.Remove(t); } Additions.Clear(); Removals.Clear(); DataLock.ReleaseMutex(); }
public void HandleAddRemoves() { AdditionMutex.WaitOne(); foreach (GameComponent component in Additions) { AddComponentImmediate(component); } Additions.Clear(); AdditionMutex.ReleaseMutex(); RemovalMutex.WaitOne(); foreach (GameComponent component in Removals) { RemoveComponentImmediate(component); } Removals.Clear(); RemovalMutex.ReleaseMutex(); }
public void RemoveComponent(GameComponent component) { RemovalMutex.WaitOne(); Removals.Add(component); RemovalMutex.ReleaseMutex(); }
public void Remove(InstanceData data) { DataLock.WaitOne(); Removals.Add(data); DataLock.ReleaseMutex(); }