Ejemplo n.º 1
0
    public virtual void OnUpdateClient()
    {
        Player player = Player.localPlayer;

        if (!player)
        {
            return;
        }

        // -- check for interaction Distance
        this.GetComponentInChildren <SpriteRenderer>().enabled = UCE_Tools.UCE_CheckSelectionHandling(this.gameObject);

        // -- check for click
        if (UCE_Tools.UCE_SelectionHandling(this.gameObject))
        {
            if (checkInteractionRange(player) && ((!interactionRequirements.hasRequirements() && !interactionRequirements.hasCosts()) || automaticActivation))
            {
                // -- when no requirements & no costs: automatically
                ConfirmAccess();
            }
            else if (checkInteractionRange(player) && interactionRequirements.checkState(player))
            {
                // -- in any other case: show confirmation UI
                ShowAccessRequirementsUI();
            }
        }
    }
Ejemplo n.º 2
0
    private void Update()
    {
        Player player = Player.localPlayer;

        if (!player)
        {
            return;
        }

        // -- check for click
        if (UCE_Tools.UCE_SelectionHandling(this.gameObject))
        {
            UCE_PlaceableObject po = this.gameObject.GetComponent <UCE_PlaceableObject>();

            if (po != null &&
                po.ownerCharacter == player.name
                )
            {
                player.UCE_myPlaceableObject = po;

                if (!_UCE_UI_PlaceableObject)
                {
                    _UCE_UI_PlaceableObject = FindObjectOfType <UCE_UI_PlaceableObject>();
                }

                _UCE_UI_PlaceableObject.Show();
            }
        }
    }