You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.7 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class movieController : MonoBehaviour
{
public float totalTime = 0.5f;
public int id;
public tuio_event tuio_event;
6 years ago
int stat;
Vector2 final_size;
//public Transform trans;
// Start is called before the first frame update
void Start()
{
6 years ago
final_size = GetComponent<RectTransform>().sizeDelta = Vector2.zero;
GetComponent<RectTransform>().sizeDelta = Vector2.zero;
stat = 0;
}
// Update is called once per frame
void Update()
{
if(name == "RawImage")
{
GetComponent<RawImage>().enabled = false;
}
else
{
GetComponent<RawImage>().enabled = true;
//Debug.Log(stat);
}
if (tuio_event.tuio_input.touchCount > 0)
{
transform.gameObject.SetActive(true);
Vector2 pos = tuio_event.tuio_input.GetTouch(id).position;
GetComponent<RectTransform>().position = new Vector3(pos.x, pos.y, 0);
}
}
void wake()
{
6 years ago
}
void die()
{
Destroy(this);
}
void doScaling(float to)
{
float from = transform.localScale.x;
float scale = from;
float startTime = Time.time;
while (scale != to)
{
float duration = Time.time - startTime;
scale = Mathf.Lerp(from, to, duration / totalTime);
transform.localScale = new Vector3(scale, scale, 1);
}
}
private void OnEnable()
{
//doScaling(1);
Debug.Log("Hi");
}
private void OnDestroy()
{
//doScaling(0);
Debug.Log("Bye");
}
}