public void CalculateTargets(MovementFinished e) { var targetsAvailable = new RangedTargetsAvailable { Targets = GameWorld.LivingCharacters .Where(x => x != GameWorld.CurrentCharacter && CanShoot(GameWorld.CurrentCharacter, x)) .Select(x => new Target { Character = x, CoverToThem = new ShotCalculation(GameWorld.CurrentCharacter.CurrentTile, x.CurrentTile).GetBestShot(), CoverFromThem = CanShoot(x, GameWorld.CurrentCharacter) ? new ShotCalculation(x.CurrentTile, GameWorld.CurrentCharacter.CurrentTile).GetBestShot() : new ShotCoverInfo(new List <CoverProvided>()) }).ToList() }; EventQueue.Instance.Add(targetsAvailable); }
private void SendActionOptionsAvailable(RangedTargetsAvailable e) { var options = new Dictionary <ActionType, Action>(); if (e.Targets.Any()) { options[ActionType.Shoot] = () => Select(new ShootSelected { AvailableTargets = e.Targets }); } if (CanHide(GameWorld.CurrentCharacter)) { options[ActionType.Hide] = () => Select(new HideSelected()); } if (GameWorld.CurrentCharacter.Gear.EquippedWeapon.IsRanged) { options[ActionType.Overwatch] = () => Select(new OverwatchSelected()); } options[ActionType.Pass] = () => Select(new PassSelected()); EventQueue.Instance.Add(new ActionOptionsAvailable { Options = options }); }