Exemple #1
0
    // -----------------------------------------------------------------------------------
    // checkInteractionRange
    // -----------------------------------------------------------------------------------
    public bool checkInteractionRange(Player player)
    {
        if (interactionRangeType == InteractionRangeType.Any || collider == null)
        {
            return(true);
        }

        float fInteractionRange = player.interactionRange;

        if (interactionRangeType == InteractionRangeType.Quadruple)
        {
            fInteractionRange *= 4;
        }
        else if (interactionRangeType == InteractionRangeType.Double)
        {
            fInteractionRange *= 2;
        }
        else if (interactionRangeType == InteractionRangeType.Half)
        {
            fInteractionRange *= 0.5f;
        }
        else if (interactionRangeType == InteractionRangeType.Quarter)
        {
            fInteractionRange *= 0.25f;
        }

        return(UCE_ClosestDistance.ClosestDistance(player.collider, collider) <= fInteractionRange);
    }
Exemple #2
0
    // -----------------------------------------------------------------------------------
    // UCE_CheckSelectionHandling
    // Validates the interaction range, the player's state and if the player is alive or not
    // @Client OR @Server
    // -----------------------------------------------------------------------------------
    public static bool UCE_CheckSelectionHandling(GameObject target, Player localPlayer = null)
    {
        if (localPlayer == null)
        {
            localPlayer = Player.localPlayer;
        }

        if (!localPlayer || !target)
        {
            return(false);
        }


        return(localPlayer.isAlive &&
               (
                   (target.GetComponent <Collider>() && UCE_ClosestDistance.ClosestDistance(localPlayer.collider, target.GetComponent <Collider>()) <= localPlayer.interactionRange) ||
                   (target.GetComponent <Entity>() && UCE_ClosestDistance.ClosestDistance(localPlayer.collider, target.GetComponent <Entity>().collider) <= localPlayer.interactionRange)
               ));
    }