private void Update() { #region FindingObjects if (ManagerPlayerOwner == null) { ManagerPlayerOwner = FindObjectOfType <NetworkEntityManagerPlayerOwner>(); } if (FpsInputController == null) { FpsInputController = FindObjectOfType <FPSInputController>(); } #endregion #region GUIKeys if (Input.GetKeyDown(KeyCode.Insert)) { BaseSettings.GetSettings.ShowEspMenu = !BaseSettings.GetSettings.ShowEspMenu; } #endregion #region Dodaj znajomych #endregion if (Input.GetMouseButton(1) && BaseSettings.GetSettings.AimBotSettings.IsEnabled) { if (_frameAimKey && Target != null) { HuamnAimbot(Target); } else { HuamnAimbot(); } } else { _frameAimKey = false; } if (Input.GetMouseButton(1)) { HuamnAimbot(); } }
public static NetworkEntityManagerPlayerProxy UpdateTargetSelector(NetworkEntityManagerPlayerProxy[] players, NetworkEntityManagerPlayerOwner owner) { NetworkEntityManagerPlayerProxy target = null; var mouseDistance = Mathf.Infinity; // dystans myszki do gracza foreach (var player in players) { if (player == null) { continue; } var distance = Vector3.Distance(owner.transform.position, player.transform.position); if (distance > 500f) { continue; } var distanceVec3 = Vector2.Distance(Input.mousePosition, Camera.main.WorldToScreenPoint(player.transform.position)); Debug.Log($"{player.GetProxyName()} {distanceVec3}"); if (distanceVec3 < mouseDistance) { mouseDistance = distanceVec3; target = player; } } if (target != null) { Debug.Log($"{target.GetProxyName()} {mouseDistance}"); } return(target); }