Esempio n. 1
0
    private void InteractWithTarget()
    {
        Debug.Log("Interact with target" + target.name);

        if (target.tag.Equals(currentInteractableObject))
        {
            /*
             * Interact with the target object. Get component to know what to do.
             */
            if (currentInteractableObject.Equals("Exit"))
            {
                /*
                 * Interacting with the exit, leaving the level
                 */
                if (hasRetrievedToy)
                {
                    Debug.Log("Par ici la sortie !");
                    endGameManager.Victory(); // Replace SceneManager
                                              //SceneManager.LoadScene(SceneController.instance.nextSceneName);
                }
            }

            if (currentInteractableObject.Equals("Carpet"))
            {
                TapisController tapis = target.GetComponent <TapisController>();
                Debug.Log("Je prends un tapis !");
                tapis.PickUp(this.gameObject);
                isHoldingObject = true;
                pickedUpTapis   = tapis;
            }

            if (currentInteractableObject.Equals("Toy"))
            {
                Debug.Log("On récupère le jouet");
                hasRetrievedToy = true;
                Destroy(target);
            }
        }
        else
        {
            Debug.Log("Mais tu te souviens de trucs louches ma parole. Oublie donc tout ça.");
            target = null;
            currentInteractableObject = "";
        }
    }