public void OnInteract(bool isHeldDown)
    {
        if (IsCarryingObject())
        {
            if (m_PickedUpObject.isThrowable && !isHeldDown)
            {
                ThrowCarryingObject();
            }
            else
            {
                PutDownCarryingObject();
            }
            return;
        }
        if (IsGrabbingObject())
        {
            StopGrabbingObject(m_GrabbedObject);
            return;
        }

        InteractableBase usableInteractable = FindUsableInteractable();

        if (usableInteractable == null)
        {
            return;
        }

        usableInteractable.OnInteract(m_Character);
    }
예제 #2
0
    public void OnInteract()
    {
        if (MovableOBJ != null)
        {
            DetatchMovableObject();
            return;
        }

        if (LiftedUpOBJ != null)
        {
            LiftedUpOBJ.GetComponent <InteractablePickUp>().Throw(Character.m_MovementModel.GetFacingDirection());
            Character.m_MovementModel.ThrowLiftedObject();
            LiftedUpOBJ = null;
            return;
        }

        InteractableBase usableInteractable = FindUsableInteractable();

        if (usableInteractable == null)
        {
            return;
        }
        if (!usableInteractable.enabled)
        {
            return;
        }
        if (!usableInteractable.isActiveAndEnabled)
        {
            return;
        }

        //Debug.Log("Found Interactable! " + usableInteractable.name);
        usableInteractable.OnInteract();
    }
예제 #3
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();
            }
        }
    }
예제 #4
0
    public void OnInteract()
    {
        InteractableBase interactable = FindUsableInteractable();

        if (null != interactable)
        {
            interactable.OnInteract();
        }
    }
    public void OnInteract()
    {
        InteractableBase usableInteractable = FindUsableInteracable();

        if (usableInteractable == null)
        {
            return;
        }

        usableInteractable.OnInteract(m_Character);
        // Debug.Log("Found InteractableBase: " + usableInteractable.name);
    }
예제 #6
0
    public override void DoAction()
    {
        InteractableBase interactableInProximity = FindInteractableInProximity();

        if (interactableInProximity == null)
        {
            DoAttack();
            return;
        }

        interactableInProximity.OnInteract();
    }
예제 #7
0
    public void OnInteract()
    {
        if (IsCarryingObject() == true)
        {
            ThrowCarryingObject();
            return;
        }

        if (Interactable != null)
        {
            Interactable.OnInteract(m_Character);
            m_IsCloseEnoughToInteract = false;
        }
    }
    public void OnInteract()
    {
        if (IsCarryingObject())
        {
            ThrowCarryingObject();
        }
        InteractableBase usableInteractable = FindUsableInteractable();

        if (usableInteractable == null)
        {
            return;
        }
        usableInteractable.OnInteract(m_Character);
    }
예제 #9
0
    //Do interact
    public void OnInteract()
    {
        if (IsCarryingObject() == true) //If the player is currently carrying an object
        {
            ThrowCarryingObject();      //Throw it
            return;
        }

        InteractableBase usableInteractable = FindUsableInteractable(); //Find an object in range that the user can interact with

        if (usableInteractable == null)
        {
            return;                                 //No interactable found
        }
        usableInteractable.OnInteract(m_Character); //Do the interact
    }
예제 #10
0
    public void OnInteract()
    {
        if (m_MovementModel.getIsCarrying() == true)
        {
            ThrowCarryingObject(false);
            return;
        }

        InteractableBase usableInteractable = FindUsableInteractable();

        if (usableInteractable == null)
        {
            return;
        }

        usableInteractable.OnInteract(m_Character);
    }
예제 #11
0
    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        InteractableBase interactable = targetGameObject.GetComponent <InteractableBase>();

        interactable.OnInteract();
    }