-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTapFlyTutorial.cs
More file actions
executable file
·42 lines (31 loc) · 981 Bytes
/
Copy pathTapFlyTutorial.cs
File metadata and controls
executable file
·42 lines (31 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using UnityEngine;
using System.Collections;
public class TapFlyTutorial : MonoBehaviour {
PlayerController playerController;
int touchCount = 0;
void Awake(){
playerController = GameObject.Find("ChickenPlayer").GetComponent<PlayerController>();
playerController.OnTouchEvent += OnLeftScreenTouched;
}
// Use this for initialization
void Start () {
RectTransform transform = gameObject.transform as RectTransform;
//Debug.Log ("ScreenWidth:" + Screen.width);
//Vector2 position = transform.anchoredPosition;
//position.x = Screen.width / 4;
//transform.anchoredPosition = position;
//Vector2 size = transform.sizeDelta;
//size.x = Screen.width / 2;
//transform.sizeDelta = size;
}
void OnLeftScreenTouched(){
touchCount ++;
if(touchCount >= 6){
playerController.OnTouchEvent -= OnLeftScreenTouched;
Destroy(gameObject);
}
}
// Update is called once per frame
void Update () {
}
}