|
|
|
|
|
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;
|
|
|
|
|
|
int stat;
|
|
|
|
|
|
Vector2 final_size;
|
|
|
|
|
|
//public Transform trans;
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
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()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|