コード例 #1
0
    void OnPlayerPrompted(PlayerPromptEvent @event)
    {
        /*
         * lister.SetActiveAll(false);
         * if (!@event._object) return;
         *
         * var interactions = controller.GetAvailableInteractions(@event._object);
         * foreach (var interaction in interactions)
         *  lister.Find(interaction)?.SetActive(true);
         *
         * bounds = @event._object.GetComponent<DynamicBounds>();
         * Relocate();
         */
        if ([email protected])
        {
            return;
        }

        lister.Find(@event.type)?.SetActive(true);
        bounds = @event.target.GetComponent <DynamicBounds>();
        Relocate();
    }
コード例 #2
0
    void OnInteracted(Interactable interactable)
    {
        if (!interactable)
        {
            return;
        }
        lister.SetActiveAll(false);

        var actions     = new List <ActionType>();
        var interactors = player.GetComponents <Interactor>();

        foreach (var interactor in interactors)
        {
            actions = actions.Union(interactor.GetActions(interactable)).ToList();
        }

        foreach (var action in actions)
        {
            lister.Find(action)?.SetActive(true);
        }

        interactingCollider = interactable.gameObject.GetComponent <Collider>();
        Relocate();
    }