Esempio n. 1
0
        public PlayerControl FindClosestTarget(PlayerControl player)
        {
            PlayerControl result = null;
            float         num    = GameOptionsData.DCAJHEGBLDD[Mathf.Clamp(PlayerControl.GameOptions.OCPGKHJJAHL, 0, 2)]; //killrange

            if (!ShipStatus.Instance)
            {
                return(null);
            }
            Vector2 truePosition = player.GetTruePosition();
            var     allPlayers   = GameData.Instance.AllPlayers;

            for (int i = 0; i < allPlayers.Count; i++)
            {
                PlayerInfo playerInfo = allPlayers[i];
                if (!playerInfo.MFFAGDHDHLO && playerInfo.FNPNJHNKEBK != player.PlayerId && !playerInfo.IAGJEKLJCCI && !playerInfo.GJPBCGFPMOD.inVent)
                {
                    PlayerControl obj = playerInfo.GJPBCGFPMOD;
                    if (obj)
                    {
                        Vector2 vector    = obj.GetTruePosition() - truePosition;
                        float   magnitude = vector.magnitude;
                        if (magnitude <= num && !PhysicsHelpers.HLIEDNLNBBH(truePosition, vector.normalized, magnitude, Constants.LEOCDMEJGPA)) //in range and prevent killing through walls
                        {
                            result = obj;
                            num    = magnitude;
                        }
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
        public PlayerControl FindClosestTarget(PlayerControl player)
        {
            PlayerControl result = null;
            float         num    = 0.4f;

            if (!ShipStatus.Instance)
            {
                return(null);
            }
            Vector2 truePosition = player.GetTruePosition();
            var     allPlayers   = GameData.Instance.AllPlayers;

            for (int i = 0; i < allPlayers.Count; i++)
            {
                PlayerInfo playerInfo = allPlayers[i];
                if (!playerInfo.MFFAGDHDHLO && playerInfo.FNPNJHNKEBK != player.PlayerId && !playerInfo.IAGJEKLJCCI && !playerInfo.GJPBCGFPMOD.inVent)
                {
                    PlayerControl obj = playerInfo.GJPBCGFPMOD;
                    if (obj)
                    {
                        Vector2 vector    = obj.GetTruePosition() - truePosition;
                        float   magnitude = vector.magnitude;
                        if (magnitude <= num && !PhysicsHelpers.HLIEDNLNBBH(truePosition, vector.normalized, magnitude, Constants.LEOCDMEJGPA))
                        {
                            result = obj;
                            num    = magnitude;
                        }
                    }
                }
            }
            return(result);
        }
        static PlayerControl setTarget(bool onlyCrewmates = false, bool targetPlayersInVents = false, List <PlayerControl> untargetablePlayers = null)
        {
            PlayerControl result = null;
            float         num    = GameOptionsData.DCAJHEGBLDD[Mathf.Clamp(PlayerControl.GameOptions.OCPGKHJJAHL, 0, 2)];

            if (!ShipStatus.Instance)
            {
                return(result);
            }

            Vector2 truePosition = PlayerControl.LocalPlayer.GetTruePosition();

            Il2CppSystem.Collections.Generic.List <GameData.LGBOMGHJELL> allPlayers = GameData.Instance.AllPlayers;
            for (int i = 0; i < allPlayers.Count; i++)
            {
                GameData.LGBOMGHJELL LGBOMGHJELL = allPlayers[i];
                if (!LGBOMGHJELL.MFFAGDHDHLO && LGBOMGHJELL.FNPNJHNKEBK != PlayerControl.LocalPlayer.PlayerId && !LGBOMGHJELL.IAGJEKLJCCI && (!onlyCrewmates || !LGBOMGHJELL.FDNMBJOAPFL))
                {
                    PlayerControl @object = LGBOMGHJELL.GJPBCGFPMOD;
                    if (untargetablePlayers != null && untargetablePlayers.Any(x => x == @object))
                    {
                        // if that player is not targetable: skip check
                        continue;
                    }

                    if (@object && ([email protected] || targetPlayersInVents))
                    {
                        Vector2 vector    = @object.GetTruePosition() - truePosition;
                        float   magnitude = vector.magnitude;
                        if (magnitude <= num && !PhysicsHelpers.HLIEDNLNBBH(truePosition, vector.normalized, magnitude, Constants.LEOCDMEJGPA))
                        {
                            result = @object;
                            num    = magnitude;
                        }
                    }
                }
            }
            return(result);
        }