private void UpdateTargets() { if (!_availableTargetsMap.ContainsKey(_hoveredPoint)) { _availableTargetsMap[_hoveredPoint] = GameWorld.LivingCharacters.Where(CanShoot).ToList(); _availableTargetsMap[_hoveredPoint].Where(x => !_attackTargetVisualMap.ContainsKey(x) && GameWorld.FriendlyPerception[x.CurrentTile.Position]).ForEach(x => { _attackTargetVisualMap[x] = new List <IVisual>(); _attackTargetAutomataMap[x] = new List <IAutomaton>(); _attackTargetVisualMap[x].Add(new ColoredRectangle { Transform = x.CurrentTile.Transform, Color = UiColors.AvailableTargetsView_Rectanges }); var anim = new TileRotatingEdgesAnim(x.CurrentTile.Position, UiColors.AvailableTargetsView_TileRotatingEdgesAnim); anim.Init(); _attackTargetVisualMap[x].Add(anim); _attackTargetAutomataMap[x].Add(anim); }); _attackTargetAggregateVisualMap[_hoveredPoint] = _availableTargetsMap[_hoveredPoint].SelectMany(x => _attackTargetVisualMap[x]).ToList(); _attackTargetAggregateAutomataMap[_hoveredPoint] = _availableTargetsMap[_hoveredPoint].SelectMany(x => _attackTargetAutomataMap[x]).ToList(); } _visuals = _attackTargetAggregateVisualMap[_hoveredPoint]; _automata = _attackTargetAggregateAutomataMap[_hoveredPoint]; }
private void ShowOptions(ShootSelected e) { var visuals = new List <IVisual>(); var automata = new List <IAutomaton>(); e.AvailableTargets.ForEach(x => { visuals.Add(new ColoredRectangle { Transform = x.Character.CurrentTile.Transform, Color = UiColors.AvailableTargetsView_Rectanges }); var anim = new TileRotatingEdgesAnim(x.Character.CurrentTile.Position, UiColors.AvailableTargetsView_TileRotatingEdgesAnim); anim.Init(); visuals.Add(anim); automata.Add(anim); }); _visuals = visuals; _automata = automata; }