Exemplo n.º 1
0
    //When te playe presses the interact button a few things could happen
    public void OnInteract(CallbackContext ctx)
    {
        if (ctx.performed)
        {
            if (!stopMovement && trackInput)
            {
                //If touching a character set up a new dialogue
                if (character != null)
                {
                    uiHandler.changeMenu(UIHandler.Menus.DIALOGUE);

                    if (!data.hasBeenTalkedTo(character))
                    {
                        beginConversation(0);
                    }
                    else
                    {
                        beginConversation(-1);
                    }

                    data.addCharacter(character);
                }
                else if (trader != null)
                {
                    //Begin a new tradign scene
                    beginTrading();
                    trader = null;
                }
                else if (pickUp != null)
                {
                    //Pick up and add this item to their inventory
                    pickUpItem();
                    pickUp = null;
                }
                else if (currentBuilding != null)
                {
                    //Enter a building
                    sceneLoader.switchScene(currentBuilding.getSceneName(), currentBuilding.GetComponent <TransitionGate>());
                }
            }
        }
    }