void OnTriggerEnter(Collider collider)
 {
     if (collider.CompareTag("Player"))
     {
         alexDialogue.AlexsObservations("PrivateConversationComing");
     }
 }
Example #2
0
    public void OnDrop(PointerEventData eventData)
    {
        Debug.Log(eventData.pointerDrag.name + "was dropped on" + gameObject.name);
        Draggable draggableItem = eventData.pointerDrag.GetComponent <Draggable> ();

        if (draggableItem != null && !gameObject.CompareTag("UseSlot"))
        {
            draggableItem.originalParent = this.transform;
            //tengo que referenciar el hidden object y decir que es null

            //19/6 VOY A HACER QUE LA MAINTENANCE KEY SE DUPLIQUE AÑADA AL INVENTARIO DEL PRESENTE AL METERLLA EN UN SLOT
            if (draggableItem.name.Contains("MaintenanceKey") && gameController.moment == 1 && gameController.maintenanceKeyAux == false)
            {
                inventory.AddMaintenanceKeyOnDrop();
                Debug.Log("Anadiendo MaintenanceKey");
                gameController.maintenanceKeyAux = true;
            }

            if (draggableItem.name.Contains("AccessCard") && gameController.moment == 1 && gameController.accessCardAddedAux == false)
            {
                inventory.AddAccessCardOnDrop();
                gameController.accessCardAddedAux = true;
            }


            if (inventory.hideAndRecoverSlotGo.gameObject.activeInHierarchy)
            {
                hideAndRecoverObjectReference = hideAndRecoverSlot.GetComponent <HideAndRecoverSlot> ();
                //hideAndRecoverObjectReference.referenceObject = null;
                hiddenObjectString = hideAndRecoverObjectReference.referenceObject.GetComponent <HideAndRecover> ();
                //hideAndRecoverObjectReference.hasReference = false;
                hiddenObjectString.hiddenItem    = null;
                hiddenObjectString.hasHiddenItem = false;
                //hiddenObjectstring.hiddenItem = null;
            }
        }

        if (gameObject.CompareTag("UseSlot"))
        {
            if (keyItem == "CardItem" && eventData.pointerDrag.CompareTag("CardItem"))
            {
                if (levelManager.firstDoorAux == true)
                {
                    levelManager.PlayLevelAnim("SecondDoor");
                    Destroy(eventData.pointerDrag);
                    slotOnEnter.SetActive(false);
                    inventory.CloseInventory();
                    Destroy(gameController.toPointGameObject);
                }

                if (levelManager.firstDoorAux == false)
                {
                    //
                    //inventory.itemsMoment0.Remove[0];
                    //
                    levelManager.PlayLevelAnim("FirstDoor");
                    Destroy(eventData.pointerDrag);
                    slotOnEnter.SetActive(false);
                    inventory.CloseInventory();
                    firstDoorAux = true;
                    levelManager.firstDoorAux = true;
                }
            }
            else if (keyItem == "CardItem" && !eventData.pointerDrag.CompareTag("CardItem"))
            {
                Debug.Log("NO ES ESTE OBJETO");
            }

            if (keyItem == "Coin" && eventData.pointerDrag.name.Contains("Coin"))
            {
                levelManager.coffeeInteraction.SetActive(true);
                Destroy(eventData.pointerDrag);
                slotOnEnter.SetActive(false);
                inventory.CloseInventory();
            }
            else if (keyItem == "Coin" && !eventData.pointerDrag.name.Contains("Coin"))
            {
                Debug.Log("NO CAFE");
            }

            if (keyItem == "Coffee" && eventData.pointerDrag.name.Contains("Coffee"))
            {
                Destroy(eventData.pointerDrag);
                slotOnEnter.SetActive(false);
                inventory.CloseInventory();
                Debug.Log("DESAPARECEN LOS ESCOMBROS");
                levelManager.DestroyDebris();
                inventory.itemsMoment0.Remove("Coffee");
                alexMonologue.AlexsObservations("DestroyDebris");
            }
            else if (keyItem == "Coffee" && !eventData.pointerDrag.name.Contains("Coffee"))
            {
                Debug.Log("POR QUÉ PONDRÍA CAFE AQUI");
            }

            if (keyItem == "Stethoscope" && eventData.pointerDrag.name.Contains("Stethoscope"))
            {
                Destroy(eventData.pointerDrag);
                slotOnEnter.SetActive(false);
                inventory.CloseInventory();
                Debug.Log("ESCUCHAR A TRAVES DE LA PUERTA");
                //AQUI VA LA LINEA QUE COMIENZA EL DIALOGO PRIVADO
                levelManager.ListenToPrivateConversation();
            }
            else if (keyItem == "Stethoscope" && !eventData.pointerDrag.name.Contains("Stethoscope"))
            {
                Debug.Log("Poner eso el la puerta sería totalmente inutil");
            }

            if (keyItem == "MaintenanceKey" && eventData.pointerDrag.name.Contains("MaintenanceKey") && levelManager.lightPanelDone == false && !gameController.toPointGameObject.name.Contains("Elevator"))
            {
                Destroy(eventData.pointerDrag);
                slotOnEnter.SetActive(false);
                inventory.CloseInventory();
                Debug.Log("Abrir Maintenance Door Present + panel");
                //AQUI VA LA LINEA QUE ABRE PANEL
                levelManager.OpenEnergyPanel();
            }
            else if (keyItem == "MaintenanceKey" && !eventData.pointerDrag.name.Contains("MaintenanceKey"))
            {
                Debug.Log("No creo que esto me ayude a abrir la puerta");
            }

            if (keyItem == "MaintenanceKey" && eventData.pointerDrag.name.Contains("MaintenanceKey") && levelManager.lightPanelDone == true)
            {
                Destroy(eventData.pointerDrag);
                slotOnEnter.SetActive(false);
                inventory.CloseInventory();
                Debug.Log("Pasar a siguiente fase");
                SceneManager.LoadScene("ThanksForPlaying");
                //AQUI VA LA LINEA DE PASAR A SIGUIENTE FASE. METEMOS LA LLAVE Y PARA ABAJO
            }
            else if (keyItem == "MaintenanceKey" && !eventData.pointerDrag.name.Contains("MaintenanceKey"))
            {
                Debug.Log("No creo que esto me ayude a abrir la puerta");
            }
            else if ((keyItem == "MaintenanceKey" && eventData.pointerDrag.name.Contains("MaintenanceKey") && levelManager.lightPanelDone == false))
            {
                Debug.Log("TODAVIA NO ESTÁ DADA LA LUZ DE ESTA PLANTA");
            }

            if (keyItem == "Screwdriver" && eventData.pointerDrag.name.Contains("Screwdriver"))
            {
                Destroy(eventData.pointerDrag);
                slotOnEnter.SetActive(false);
                inventory.CloseInventory();
                levelManager.FixLightTubes();
            }
            else if (keyItem == "Screwdriver" && !eventData.pointerDrag.name.Contains("Screwdriver"))
            {
                Debug.Log("No creo que un destornillador me ayude");
            }
        }
    }
    void GetToItem()
    {
        if (isOn && Input.GetKeyDown(KeyCode.Mouse0))
        {
            if (Vector3.Distance(closePosition.transform.position, player.transform.position) < closePositionDistance)
            {
                if (gameObject.name.Contains("AccessCard") && inventory.card1 == false)
                {
                    inventory.card1 = true;
                    inventory.AddItem("AccessCard", true);                     //añado item a el hud de inventario

                    if (alexsMonologue.stringIndex >= 9)
                    {
                        //alexsMonologue.AlexsObservations ("FirstCard");
                        //gameController.ableToTravel = false;
                        alexsMonologue.block++;
                        gameController.ShowTutorialLockedIcon("PlantPotIcons");
                    }


                    Destroy(gameObject);
                }

                if (gameObject.name.Contains("Stethoscope"))
                {
                    inventory.AddItem("Stethoscope", true);                     //añado item a el hud de inventario
                    Destroy(gameObject);
                }

                if (gameObject.name.Contains("CoinFalse"))
                {
                    alexsMonologue.AlexsObservations("NoMoney");
                    Destroy(gameObject);
                }

                if (gameObject.name.Contains("CoinTrue"))
                {
                    alexsMonologue.AlexsObservations("MoneyFound");
                    inventory.AddItem("Coin", true);
                    Destroy(gameObject);
                }

                if (gameObject.name.Contains("Coffee"))
                {
                    alexsMonologue.AlexsObservations("Coffee");
                    inventory.AddItem("Coffee", true);
                    Destroy(gameObject);
                }

                if (gameObject.name.Contains("MaintenanceKey"))
                {
                    alexsMonologue.AlexsObservations("MaintenanceKey");
                    inventory.AddItem("MaintenanceKey", true);
                    Destroy(gameObject);
                }

                if (gameObject.name.Contains("Screwdriver"))
                {
                    alexsMonologue.AlexsObservations("Screwdriver");
                    inventory.AddItem("Screwdriver", true);
                    Destroy(gameObject);
                }
            }
            else
            {
                moveToClosePosition = true;                 //COMENTADO PARA METERLO EN EL IF
            }
        }
        if (moveToClosePosition == true && Vector3.Distance(closePosition.transform.position, player.transform.position) > closePositionDistance)
        {
            player.transform.position = Vector3.MoveTowards(player.transform.position, new Vector3(closePosition.transform.position.x, player.transform.position.y, closePosition.transform.position.z), moveSpeed * Time.deltaTime);
            Debug.Log("MOVIENDOSE AL OBJETIVO");


            //Vector3 elnuevo =Vector3.Scale(closePosition.transform.position, new Vector3(1,0,1))

            //ESTA LINEA DE ARRIBA LA HIZO BEÑAT. MULTIPLICA VECTORES. SI PONES EN UNO "0", EL VALOR CON EL QUE MULTILPIQUE SERÁ 0

            characterBehaviour.LookTowards(closePosition.transform);
            characterBehaviour.GoToPoint(true);
        }

        if (Vector3.Distance(closePosition.transform.position, player.transform.position) < closePositionDistance)
        {
            characterBehaviour.goingToPoint = false;
            characterBehaviour.GoToPoint(false);
            //Debug.Log ("PARAAAAAAA");
        }

        if (moveToClosePosition == true && Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.D))
        {
            moveToClosePosition = false;
        }

        if (Vector3.Distance(closePosition.transform.position, player.transform.position) < closePositionDistance)
        {
            isPlayerClose = true;
            //Debug.Log ("PLAYER CLOSSSE");
        }
        else
        {
            isPlayerClose = false;
        }
    }
    void GetToInteraction()
    {
        if (isOn && Input.GetKeyDown(KeyCode.Mouse0))
        {
            if (Vector3.Distance(closePosition.transform.position, player.transform.position) < closePositionDistance)
            {
                gameController.Inventory();
                inventory.canUseObject = true;

                if (gameObject.name == "DoorLock")
                {
                    //Debug.Log ("Funciona");
                    useSlot.keyItem = "CardItem";

                    if (firstTimeInteraction == true)                     // && alexMonologue.stringIndex >= 10

                    {
                        alexMonologue.AlexsObservations("FirstDoor");
                        firstTimeInteraction = false;                         //ELIMINADO EL 26/04 PARA NO TRIGGEREAR EL GUION
                        gameController.ShowTriggeredTutorial("InventoryAndUseSlot");
                    }
                }

                if (gameObject.name.Contains("SecondDoorLock"))
                {
                    Debug.Log("TARJETA SEGUNDA PUERTA");
                    useSlot.keyItem = "CardItem";
                }

                if (gameObject.name.Contains("CoffeeMachine"))
                {
                    useSlot.keyItem = "Coin";
                }

                if (gameObject.name.Contains("NotWorkingCoffeeMachine"))
                {
                    useSlot.keyItem = "Coffee";
                }

                if (gameObject.name.Contains("MaintenanceDoorPresent"))
                {
                    useSlot.keyItem = "MaintenanceKey";
                }

                if (gameObject.name.Contains("MaintenanceDoorPast"))
                {
                    useSlot.keyItem = "Stethoscope";
                }

                if (gameObject.name.Contains("Elevator"))
                {
                    useSlot.keyItem = "MaintenanceKey";
                }

                if (gameObject.name.Contains("Screwdriver"))
                {
                    useSlot.keyItem = "Screwdriver";
                }
            }
            else
            {
                moveToClosePosition = true;                 //COMENTADO PARA METERLO EN EL IF
            }
        }
        if (moveToClosePosition == true && Vector3.Distance(closePosition.transform.position, player.transform.position) > closePositionDistance)
        {
            player.transform.position = Vector3.MoveTowards(player.transform.position, new Vector3(closePosition.transform.position.x, player.transform.position.y, closePosition.transform.position.z), moveSpeed * Time.deltaTime);
            characterBehaviour.LookTowards(closePosition.transform);
            characterBehaviour.GoToPoint(true);
            //
            Debug.Log("OhShitWaddap");
            gameController.UpdateGotoPointGo(gameObject);
            //
        }

        if (Vector3.Distance(closePosition.transform.position, player.transform.position) < closePositionDistance)
        {
            characterBehaviour.goingToPoint = false;
            characterBehaviour.GoToPoint(false);
            //Debug.Log ("PARAAAAAAA");
        }

        if (moveToClosePosition == true && Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.D))
        {
            moveToClosePosition = false;
        }

        if (Vector3.Distance(closePosition.transform.position, player.transform.position) < closePositionDistance)
        {
            isPlayerClose = true;
            if (observationIcon != null)
            {
                observationIcon.SetActive(true);
            }

            //Debug.Log ("PLAYER CLOSSSE");
        }
        else
        {
            isPlayerClose = false;
            if (observationIcon != null)
            {
                observationIcon.SetActive(false);
            }
        }
    }
    public void ListenToPrivateConversation()
    {
        AlexDialogueLvl_1andTutorial alexMonologue = character.GetComponent <AlexDialogueLvl_1andTutorial> ();

        alexMonologue.AlexsObservations("PrivateConversation");
    }