Exemplo n.º 1
0
    private void UpdateAction()
    {
        if (Input.GetKeyDown(KeyCode.D))
        {
            if (menuView.GetMenuActive() == true)
            {
                TitleScreenView.Instance.ActionPresed();
            }

            InteractableBase interactableBase = playerStats.GetInteractableBase();

            if (DialogueTextUI.Instance.GetDialogueBoxActive() == true)
            {
                interactableBase.GetComponent <DialogueBase>().DoSpeech();
                return;
            }

            if (interactableBase != null)
            {
                interactableBase.OnInteract();
            }
            else
            {
                OnAttackPressed();
            }
        }
    }
Exemplo n.º 2
0
 protected void Interacting()
 {
     if (interactTarget != null)
     {
         interactTarget?.Interact(this);
         if (interactTarget.GetComponent <HyperSeed>() != null)
         {
             _animator.SetBool("getHyperSeedAni", true);
         }
         else if (interactTarget.GetComponent <OreVein>() != null)
         {
             _animator.SetBool("getAmmoAni", true);
         }
         interactTarget = null;
         lastInteract   = Time.fixedTime;
     }
     currentState = PlayerState.Neutral;
 }
Exemplo n.º 3
0
    //author: Ben Stern
    /// <summary>
    /// Place an item into this container
    /// </summary>
    /// <param name="itemToHold">The item to place into the container</param>
    public void HoldItem(InteractableBase itemToHold)
    {
        itemsHolding.Add(itemToHold);
        //move the item into the container
        itemToHold.transform.position = transform.position + PlacePositionRelative;
        itemToHold.transform.SetParent(transform);
        //call any interaction that happen when this item is placed in a container
        itemToHold.Interact("On Place In Container", interactableComponent);
        //objects in containers should not be selectable until taken out of the container
        itemToHold.GetComponent <SelectableObject>().enabled = false;

        //add the empty into to interaction to the list
        interactableComponent.AddInteractionToList("Empty into", EmptyInto);
    }
    //author: John Vance, Ben Stern
    /// <summary>
    /// Gets the Frying Pan to be used elsewhere
    /// </summary>
    /// <param name="pan">The container that the utensil is being used on</param>
    public void HoldItem(InteractableBase pan)
    {
        currentContainer = pan;

        //move the item into the container
        transform.position = currentContainer.transform.position + PlacePositionRelative;
        //transform.SetParent(itemHolding.transform);

        if (currentContainer.transform.childCount > 0)
        {
            //move item inside container to new container
            InteractableBase child = currentContainer.transform.GetChild(0).gameObject.GetComponent <InteractableBase>();
            Debug.Log("3: " + child);

            child.transform.position = transform.position;
            child.transform.SetParent(transform);

            //objects in containers should not be selectable until taken out of the container
            currentContainer.GetComponent <SelectableObject>().enabled = false;

            //add the empty into to interaction to the list
            interactableComponent.AddInteractionToList("Empty into", EmptyInto);
        }
    }