Skip to content
Snippets Groups Projects
Kalender.cs 1.02 KiB
Newer Older
JonuziFlorina's avatar
JonuziFlorina committed
using Microsoft.MixedReality.Toolkit.Input;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class Kalender : MonoBehaviour, IMixedRealityTouchHandler
{
    public TextMeshPro textMesh;

    void Start()
    {
        SetTextVisibility(false); // Initial unsichtbar
    }

    public void OnTouchStarted(HandTrackingInputEventData eventData)
    {
        SetTextVisibility(true); // Sichtbar machen
    }

    public void OnTouchCompleted(HandTrackingInputEventData eventData)
    {
        SetTextVisibility(false); // Wieder unsichtbar machen
    }

    public void OnTouchUpdated(HandTrackingInputEventData eventData) { }

    void SetTextVisibility(bool isVisible)
    {
        if (isVisible)
        {
            textMesh.color = new Color(textMesh.color.r, textMesh.color.g, textMesh.color.b, 1.0f); // Voll sichtbar
        }
        else
        {
            textMesh.color = new Color(textMesh.color.r, textMesh.color.g, textMesh.color.b, 0.0f); // Unsichtbar
        }
    }
}