Пример #1
0
        public void Update()
        {
            if (Time.time - ultimaComprobacion > comprobacion)
            {
                ultimaComprobacion = Time.time;

                Ray        ray = camara.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit, distanciaMaxima, interactuableLayer) == true)
                {
                    if (hit.collider.gameObject != actualInteraccionGameObject)
                    {
                        actualInteraccionGameObject = hit.collider.gameObject;
                        actualInteraccion           = hit.collider.GetComponent <IInteractuable>();
                        MostrarMensajeTexto();
                    }
                }
                else
                {
                    actualInteraccionGameObject = null;
                    actualInteraccion           = null;
                    Canvas.Juego.instancia.mensajeInteraccion.gameObject.SetActive(false);
                }
            }
        }
Пример #2
0
 public void InteractuarInput(InputAction.CallbackContext contexto)
 {
     if (contexto.phase == InputActionPhase.Started && actualInteraccion != null)
     {
         actualInteraccion.Interactuar();
         actualInteraccionGameObject = null;
         actualInteraccion           = null;
         Canvas.Juego.instancia.mensajeInteraccion.gameObject.SetActive(false);
     }
 }
Пример #3
0
        private double DistanciaA(IInteractuable mesh)
        {
            TGCVector3 vector = personaje.getPosition() - mesh.getPosition();

            return(Math.Sqrt(Math.Pow(vector.X, 2) + Math.Pow(vector.Z, 2)));
        }
Пример #4
0
 public void InteractuarConObjeto(IInteractuable objeto)
 {
     objeto.Interactuar(this);
 }
 private void InteractionChanged(IInteractuable interactuable)
 {
     gameObject.SetActive(interactuable.CanInteract);
     _icon.sprite = interactuable.Icon;
 }