Exemplo n.º 1
0
            static PlayerControl FindClosestTarget(ref PlayerControl local)
            {
                PlayerControl result = null;

                if (!ShipStatus.Instance)
                {
                    return(null);
                }
                float distance = GameOptionsData.JMLGACIOLIK[Mathf.Clamp(PlayerControl.GameOptions.DLIBONBKPKL, 0, 2)];
                var   truePos  = local.GetTruePosition();

                foreach (var p in GameData.Instance.AllPlayers)
                {
                    if (!p.OMHGJKAKOHO && p.JKOMCOJCAID != local.PlayerId && !p.DLPCKPBIJOE)
                    {
                        var control = p.LAOEJKHLKAI;
                        if (control != null)
                        {
                            var   vector    = control.GetTruePosition() - truePos;
                            float magnitude = vector.magnitude;
                            if (magnitude <= distance && !PhysicsHelper.IIPMKCELMED(truePos, vector.normalized, magnitude, Constants.BBHMKOHHIKI))
                            {
                                result   = control;
                                distance = magnitude;
                            }
                        }
                    }
                }

                return(result);
            }
Exemplo n.º 2
0
        public InnerPlayerControl FindClosestTarget(InnerPlayerControl player)
        {
            InnerPlayerControl result = null;
            float num = GameOptionsData.JMLGACIOLIK[Mathf.Clamp(InnerPlayerControl.GameOptions.DLIBONBKPKL, 0, 2)];

            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.OMHGJKAKOHO && playerInfo.JKOMCOJCAID != player.PlayerId && !playerInfo.DLPCKPBIJOE && !playerInfo.LAOEJKHLKAI.inVent)
                {
                    InnerPlayerControl obj = playerInfo.LAOEJKHLKAI;
                    if (obj)
                    {
                        Vector2 vector    = obj.GetTruePosition() - truePosition;
                        float   magnitude = vector.magnitude;
                        if (magnitude <= num && !PhysicsHelpers.IIPMKCELMED(truePosition, vector.normalized, magnitude, Constants.BBHMKOHHIKI))
                        {
                            result = obj;
                            num    = magnitude;
                        }
                    }
                }
            }
            return(result);
        }