Esempio n. 1
0
    /// Called when the user is looking on a valid GameObject. This can be a 3D
    /// or UI element.
    ///
    /// The camera is the event camera, the target is the object
    /// the user is looking at, and the intersectionPosition is the intersection
    /// point of the ray sent from the camera on the object.
    public void OnGazeStart(Camera camera, GameObject targetObject, Vector3 intersectionPosition, bool isInteractive)
    {
        //    Debug.Log("Obejto: " + targetObject.layer.ToString());
        //Debug.Log("Vizualizando o Tela: " + targetObj.layer.ToString());
        if (isInteractive)
        {
            if (targetObject.gameObject.layer == 14)
            {
                PlayerVRAutoWalk.podeAndar = false;
            }
            iconGaze.enabled = true;
            this.gameObject.GetComponent <MeshRenderer>().enabled = false;
            if (targetObject.gameObject.layer == 11)
            {
                changeGaze(targetObject.gameObject.layer);
            }
            else
            {
                gazeType = GazeType.EMPTY;
            }

            if (targetObject.CompareTag("Personagens"))
            {
                targetObject.GetComponent <InformacaoPerosonagem>().ShowUI();
            }
            //CarregaInformacoes();
            if (buscarInformacao)
            {
                Debug.Log("Pode Buscar Informacao");
                if (targetObject.CompareTag("ItemInformativo"))
                {
                    exibindoInfo = true;
                    //gazeType = GazeType.EMPTY;
                    //HideGaze();
                    targetObject.GetComponent <InformationItem>().GetInformacaoItem();
                }
            }
        }
        else if (targetObject.gameObject.layer == 11)
        {
            //Debug.Log("Piso");
            MudarCorGaze(1);
            this.gameObject.GetComponent <MeshRenderer>().enabled = false;
            iconGaze.GetComponent <Image>().enabled = true;
        }



        SetGazeTarget(intersectionPosition, isInteractive);
        if (isInteractive || targetObject.gameObject.layer == 11)
        {
            changeGaze(targetObject.gameObject.layer);
        }
        else
        {
            gazeType = GazeType.EMPTY;
        }
    }
Esempio n. 2
0
    public void changeGaze(LayerMask layer)
    {
        //Debug.Log(layer.value);
        switch (layer.value)
        {
        case 10:
            gazeType = GazeType.TALK;
            break;

        case 11:
            //Debug.Log("No Piso");
            gazeType = GazeType.WALK;
            break;

        case 12:
            gazeType = GazeType.INFO;
            break;

        case 13:
            gazeType = GazeType.DOOR;
            break;

        case 14:
            this.gameObject.GetComponent <MeshRenderer>().enabled = true;
            gazeType = GazeType.EMPTY;
            break;

        case 16:
            //this.gameObject.GetComponent<MeshRenderer>().enabled = true;
            gazeType = GazeType.VEHICLE;
            break;

        case 0:
            gazeType = GazeType.EMPTY;
            break;
        }

        switch (gazeType)
        {
        case GazeType.WALK:
            //Debug.Log("Pode andar");
            PlayerAndar(true);
            iconGaze.GetComponent <Image>().sprite = iconWalk;
            break;

        case GazeType.INFO:

            iconGaze.GetComponent <Image>().sprite = iconInfo;
            break;

        case GazeType.TALK:
            //Debug.LogError(reticleDistanceInMeters);

            iconGaze.GetComponent <Image>().sprite = iconTalk;
            break;

        case GazeType.DOOR:

            iconGaze.GetComponent <Image>().sprite = iconDoor;
            break;

        case GazeType.VEHICLE:
            iconGaze.GetComponent <Image>().sprite = iconVehicle;
            break;

        case GazeType.EMPTY:
            HideGaze();
            break;
        }
    }