private static void CalculateInitVision(VisibilityCalculator visibilityCalculator, PerceptionCalculator perceptionCalculator, FrinedlyPerceptionUpdater perceptionUpdater) { GameWorld.Characters.ForEach(x => { visibilityCalculator.UpdateSight(x); perceptionCalculator.UpdatePerception(x); }); perceptionUpdater.UpdatePerception(); }
public void Init() { base.GetOffset = () => new Transform2(-_camera.Position.ToVector2()); // TODO: Make Mouse Management a separate component Event.Subscribe(EventSubscription.Create <MovementOptionsAvailable>(e => _mouseAction = MouseAction.Move, this)); Event.Subscribe(EventSubscription.Create <MovementConfirmed>(e => _mouseAction = MouseAction.None, this)); Event.Subscribe(EventSubscription.Create <ShootSelected>(e => _mouseAction = MouseAction.Shoot, this)); Event.Subscribe(EventSubscription.Create <MenuRequested>(e => _shouldIgnoreClicks = true, this)); Event.Subscribe(EventSubscription.Create <MenuDismissed>(e => _shouldIgnoreClicks = false, this)); var clickUI = new ClickUI(); var visibilityCalculator = new VisibilityCalculator(); var perceptionCalculator = new PerceptionCalculator(); var perceptionUpdater = new FrinedlyPerceptionUpdater(); Add(clickUI); Add(new EnemyAI()); Add(new ActionOptionsCalculator()); Add(new HideUI()); Add(new MovementOptionsCalculator()); Add(new ShootOptionsCalculator()); Add(new ProposedShotCalculator()); Add(new AvailableTargetsUI()); Add(visibilityCalculator); Add(perceptionCalculator); Add(perceptionUpdater); Add(new FriendlyVisionCalculator()); Add(new NewEnemySpotter()); Add(new DialogWatcher()); //TODO: trash class here Add(new TargetKilledSceneTransition()); Add(EventQueue.Instance); Add(_drawMaster); Add(_combat); Add(_camera); #if DEBUG Add(new RecentEventDebugLogView { Position = new Vector2(0, 150), MaxLines = 30, HideTextPart = "ZeroFootPrintSociety." }); #endif Add(new HudView(clickUI)); GameWorld.Highlights = new Highlights(); GameWorld.HighHighlights = new HighHighlights(); Add((IAutomaton)GameWorld.Highlights); Add((IAutomaton)GameWorld.HighHighlights); CalculateInitVision(visibilityCalculator, perceptionCalculator, perceptionUpdater); _combat.Init(); _camera.Init(_startingCameraTile); }