Newer
Older
HoloAnatomy / Assets / HoloToolkit-Examples / Input / Scripts / TapResponder.cs
SURFACEBOOK2\jackwynne on 25 May 2018 836 bytes v1
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using UnityEngine;

namespace HoloToolkit.Unity.InputModule.Tests
{
    /// <summary>
    /// This class implements IInputClickHandler to handle the tap gesture.
    /// It increases the scale of the object when tapped.
    /// </summary>
    public class TapResponder : MonoBehaviour, IInputClickHandler
    {
        public void OnInputClicked(InputClickedEventData eventData)
        {
            // Increase the scale of the object just as a response.
            gameObject.transform.localScale += 0.05f * gameObject.transform.localScale;

            eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.
        }
    }
}