Skip to content

Instantly share code, notes, and snippets.

@bibinba
Created February 1, 2018 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bibinba/3c114d33668ce0b79c93e8dad0b9dad4 to your computer and use it in GitHub Desktop.
Save bibinba/3c114d33668ce0b79c93e8dad0b9dad4 to your computer and use it in GitHub Desktop.
大きさを変える
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using HoloToolkit.Unity.InputModule;
using UnityEngine.VR.WSA.Input;
public class height_change : MonoBehaviour,IInputClickHandler
{
public Text text;
public GameObject yome;
int height=151;
float kiso = 151.0f;
public float v=1f;
private GestureRecognizer gesture;
private bool airTapped;
// Use this for initialization
void Start () {
}
public void OnInputClicked(InputClickedEventData eventData)
{
height = height + 2;
Updateheight(height);
}
void Update () {
Updateheight(height);
}
void Updateheight(int height)
{
v = (float)height / kiso;
yome.transform.localScale = new Vector3(v, v, v);////Unityちゃんの大きさをv倍
string h = ((int)(v * kiso)).ToString();
text.text = h + "cm";
}
public void onue()
{
height = height + 2;
Updateheight(height);
Debug.Log(height);
}
public void onsita()
{
height = height - 4;
Updateheight(height);
Debug.Log(height);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment