public void UpdateState() { if (!MobileObjectsManager.CreatureContainsInGame(Player)) { PlayerLost = true; return; } if (Player.Inventory.Cost == MapManager.LevelCost) { PlayerWon = true; return; } foreach (var creature in MobileObjectsManager.MobileObjects) { var query = creature.GetIntention(); if (ValidateRequest(query, creature)) { ExecuteIntention(query, creature); creature.ActionTaken(query); } else { creature.ActionRejected(query); } } TemporaryObjectsManager.UpdateTemporaryObjects(); MobileObjectsManager.UpdateAnimates(); }
public void TestRemovingDeadObject() { var objects = new HashSet <SampleTemporaryObject>(); var temp = new SampleTemporaryObject(1, objects); objects.Add(temp); TemporaryObjectsManager.AddTemporaryObject(temp); TemporaryObjectsManager.UpdateTemporaryObjects(); Assert.IsEmpty(objects); }
public void TestRemovingOnlyDeadObjects() { var objects = new HashSet <SampleTemporaryObject>(); var first = new SampleTemporaryObject(1, objects); var second = new SampleTemporaryObject(2, objects); objects.Add(first); objects.Add(second); TemporaryObjectsManager.AddTemporaryObject(first); TemporaryObjectsManager.AddTemporaryObject(second); TemporaryObjectsManager.UpdateTemporaryObjects(); Assert.IsNotEmpty(objects); }
public void AddNoiseSource(NoiseSource source) { TemporaryObjectsManager.AddTemporaryObject(source); Dijkstra.DijkstraTraversal(Noises, source, (noises, noise) => { noises.Add(noise); }); }