|
|
|
|
@ -8,70 +8,66 @@ public class movieController : MonoBehaviour |
|
|
|
|
public float totalTime = 0.5f; |
|
|
|
|
public int id; |
|
|
|
|
public tuio_event tuio_event; |
|
|
|
|
int stat; |
|
|
|
|
public float fade_speed = 0.02f; |
|
|
|
|
public int stat; |
|
|
|
|
Vector2 final_size; |
|
|
|
|
float c; |
|
|
|
|
Vector2 pos, pre_pos; |
|
|
|
|
//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; |
|
|
|
|
final_size = GetComponent<RectTransform>().sizeDelta; |
|
|
|
|
GetComponent<RawImage>().color = Color.clear; |
|
|
|
|
pos = Vector2.zero; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Update is called once per frame |
|
|
|
|
void Update() |
|
|
|
|
{ |
|
|
|
|
if(name == "RawImage") |
|
|
|
|
//Debug.Log(stat); |
|
|
|
|
pre_pos = pos; |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
if (stat == 1) |
|
|
|
|
pos = tuio_event.tuio_input.GetTouch(id).position; |
|
|
|
|
else if (stat == 2) |
|
|
|
|
pos = pre_pos; |
|
|
|
|
GetComponent<RectTransform>().position = new Vector3(pos.x, pos.y, 0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void wake() |
|
|
|
|
if(stat == 1) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
c += fade_speed; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void die() |
|
|
|
|
{ |
|
|
|
|
Destroy(this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void doScaling(float to) |
|
|
|
|
{ |
|
|
|
|
float from = transform.localScale.x; |
|
|
|
|
float scale = from; |
|
|
|
|
float startTime = Time.time; |
|
|
|
|
while (scale != to) |
|
|
|
|
else if (stat == 2) |
|
|
|
|
{ |
|
|
|
|
float duration = Time.time - startTime; |
|
|
|
|
scale = Mathf.Lerp(from, to, duration / totalTime); |
|
|
|
|
transform.localScale = new Vector3(scale, scale, 1); |
|
|
|
|
c -= fade_speed; |
|
|
|
|
if (c < 0f) Destroy(gameObject); |
|
|
|
|
} |
|
|
|
|
c = Mathf.Clamp(c, 0f, 1f); |
|
|
|
|
GetComponent<RawImage>().color = new Color(1f, 1f, 1f, c); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void OnEnable() |
|
|
|
|
{ |
|
|
|
|
//doScaling(1); |
|
|
|
|
stat = 1; |
|
|
|
|
c = 0f; |
|
|
|
|
Debug.Log("Hi"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void OnDestroy() |
|
|
|
|
{ |
|
|
|
|
//doScaling(0); |
|
|
|
|
Debug.Log("Bye"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|