コード例 #1
0
 public void NearToDossier()
 {
     if (InventoryPlayer.instance.isReading == false)
     {
         //ON recupere la variable displayInfo de InventoryPlayer
         display = InventoryPlayer.instance.displayInfo;
         //L'image de imageDossier est celle recupérer dans la variable display
         display.ReadMe();
         GoImage.SetActive(true);
         InventoryPlayer.instance.isReading = true;
     }
     else
     {
         GoImage.SetActive(false);
         InventoryPlayer.instance.isReading = false;
     }
 }
コード例 #2
0
    private void Update()
    {
        if (GameManager._instance.gotKnife == false)
        {
            arme.SetActive(false);
        }
        else if (GameManager._instance.gotKnife == true)
        {
            arme.SetActive(true);
        }



        //ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        ray = new Ray(actionRay.position, transform.forward);

        Debug.DrawRay(actionRay.position, transform.forward, Color.green);
        if (Physics.Raycast(ray, out hit, interactionDistance))
        {
            Debug.Log("hit : " + hit.collider.gameObject.name);
            //si le tag de l'bojet touché avec le raycast est "casier"
            if (hit.collider.gameObject.CompareTag("casier"))
            {
                if (!GameManager._instance.isHidden)
                {
                    // Afficher UI Correspondante



                    //Si on appuie sur le clique gauche
                    if (Input.GetMouseButtonDown(0))
                    {
                        Cachette cachette = hit.collider.gameObject.GetComponent <Cachette>();
                        if (cachette)
                        {
                            GameManager._instance.HideToSpot(cachette.cam);
                        }
                        SoundManager.instance.Play("CasierOpen");
                    }
                }
            }

            if (Physics.Raycast(ray, out hit, interactionDistance))
            {
                if (hit.collider.gameObject.CompareTag("Dossier"))
                {
                    // Afficher UI correspondante



                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        //Debug.Log("Press E");
                        displayInfo = hit.transform.gameObject.GetComponent <DisplayDossier>();
                        UIManager._instance.NearToDossier();
                        Debug.Log("c'est un dossier");
                    }
                }
            }
        }

        if (onObjectTrigger == true)
        {
            if (Input.GetKeyDown(KeyCode.E))
            {
                if (actualObject.GetComponent <Animator>().GetBool("Open"))
                {
                    actualObject.GetComponent <Animator>().SetBool("Open", false);
                    //SoundManager.instance.Play("Grincement");
                    actualObject.GetComponent <AudioSource>().Play();
                }
                else if (GameManager._instance.gotKey == true)
                {
                    Debug.Log("toctoc");
                    actualObject.GetComponent <AudioSource>().Play();
                    //SoundManager.instance.Play("TocToc");
                    actualObject.GetComponent <Animator>().SetBool("Open", true);
                }
                else
                {
                    //SoundManager.instance.Play("TocToc");
                    actualObject.GetComponent <GetSound>().Play("TocToc");
                }
            }


            else if (actualObject.tag == "casier")
            {
                if (Input.GetKeyDown(KeyCode.H))
                {
                    Debug.Log("Ouverture casier");
                    SoundManager.instance.Play("CasierClose");
                }
            }
        }
    }