public void ShowHitChance() { CharacterComponent player = _playerControl.CharacterComponent; if (!CanShowHud()) { _huds.Cleanup(); return; } PlayerHUD_Proxy playerHud = new PlayerHUD_Proxy(Game.World.HUD); Node movementTarget = playerHud.FindMovementTargetNode(); HashSet <String> remainingHuds = _huds.GetKnownHudNames(); using (PinnedCharacterPosition.Hack(player, movementTarget)) { foreach (VisibleTargetHud visible in EnumerateVisibleEnemyHuds(player)) { if (!visible.TryGetAimInfo(_playerControl, out String aimInfo)) { continue; } TargetHitHud hud = _huds.ProvideHud(playerHud, visible.Character); hud.Refresh(visible.ScreenPoint, aimInfo); remainingHuds.Remove(hud.Name); } } remainingHuds.Do(_huds.DisableHud); }
public static PinnedCharacterPosition Hack(CharacterComponent cc, Node movementTarget) { PinnedCharacterPosition result = new PinnedCharacterPosition(cc); if (movementTarget != null) { result.Cell.X = movementTarget.x; result.Cell.Y = movementTarget.y; result.Character.transform.position = movementTarget.GetPosition(); } return(result); }