Esempio n. 1
0
    //public bool StoreOnDisplay = false;

    //void Awake()
    //{
    //    StoreDeHell.SetActive(false);
    //}

    void Update()
    {
        // Is Player trying to interact
        // if (Input.GetButtonDown("Interact") || Input.GetButton("Interact"))
        if (Input.GetButtonDown("Interact"))
        {
            Debug.Log("Player is attempting to interact");
            // Check if the player is with D4N
            if (WithD4N == true)
            {
                Debug.Log(D4NManager.PlayerInteracting);
                Debug.Log("player is interacting with D4N");
                D4NManager.PlayerInteracting = true;
            }
            // Check if the player is at the store
            //if (GameManager.AtStore == true) // Player at the store
            //{
            //    // Check if the store is on display
            //    if (StoreOnDisplay == false) // Store is not on display
            //    {
            //        StoreDeHell.SetActive(true); // Turn on StoreDeHell canvas
            //        StoreOnDisplay = true;
            //    }
            //    else if (StoreOnDisplay == true) // Store is on display
            //    {
            //        StoreDeHell.SetActive(false); // Turn off StoreDeHell Canvas
            //        StoreOnDisplay = false;
            //    }
            //}

            if (currentInteractionObject)
            {
                currentInteractionScript.DoInteraction(currentInteractionObject);
            }
            else if (gameObjectInventory)
            {
                currentInteractionScript.DoInteraction(gameObjectInventory);
            }
        }

        if (Input.GetKey("s") && onStair || Input.GetAxis("VerticalDown") >= 1 && onStair)
        {
            playerInteractionStair.isClimbing = true;
            playerInteractionStair.ClimbDown();
        }
        else if (Input.GetKey("w") && onStair || Input.GetAxis("VerticalUp") == -1 && onStair)
        {
            playerInteractionStair.isClimbing = true;
            playerInteractionStair.ClimbUp();
        }
        else if (onStair)
        {
            playerInteractionStair.StopClimbing();
        }
        else if (nameEnviroment)
        {
            playerInteractionStair.StopClimbing2();
        }

        if (Input.GetButtonDown("Cancel") || Input.GetButton("CloseInventory"))
        {
            currentInteractionScript.HideCanvas();
        }
    }