void Reset() { isPlaying = false; isCopied = false; B1.GetComponent <TrailRenderer>().time = 0.0f; B1.SetActive(false); B1.GetComponent <Ball>().Dead = false; B2.GetComponent <TrailRenderer>().time = 0.0f; B2.SetActive(false); B2.GetComponent <Ball>().Dead = false; B3.SetActive(false); B3.GetComponent <TrailRenderer>().time = 0.0f; B3.GetComponent <Ball>().Dead = false; B4.SetActive(false); B4.GetComponent <TrailRenderer>().time = 0.0f; B4.GetComponent <Ball>().Dead = false; B5.SetActive(false); B5.GetComponent <TrailRenderer>().time = 0.0f; B5.GetComponent <Ball>().Dead = false; B6.SetActive(false); B6.GetComponent <TrailRenderer>().time = 0.0f; B6.GetComponent <Ball>().Dead = false; B7.SetActive(false); B7.GetComponent <TrailRenderer>().time = 0.0f; B7.GetComponent <Ball>().Dead = false; ChangeColor(0); }
//public GameObject Starter; //bool A = true; //bool B = true; // Use this for initialization void Awake() { isPlaying = false; isCopied = false; //StartCoroutine ("Updat"); Rb1 = B1.GetComponent <Rigidbody2D> (); Rb2 = B2.GetComponent <Rigidbody2D> (); Rb3 = B3.GetComponent <Rigidbody2D> (); Rb4 = B4.GetComponent <Rigidbody2D> (); Rb5 = B5.GetComponent <Rigidbody2D> (); Rb6 = B6.GetComponent <Rigidbody2D> (); Rb7 = B7.GetComponent <Rigidbody2D> (); Tr1 = B1.transform; Tr2 = B2.transform; Tr3 = B3.transform; Tr4 = B4.transform; Tr5 = B5.transform; Tr6 = B6.transform; Tr7 = B7.transform; Pos1 = Out1.transform.position; Pos2 = Out2.transform.position; Pos3 = Out3.transform.position; Pos4 = Out4.transform.position; Pos5 = Out5.transform.position; Pos6 = Out6.transform.position; Pos7 = Out7.transform.position; S = GetComponent <SpriteRenderer> (); }
void Reset() { if (isChange) { for (int i = 0; i < 4; i++) { Change [i].color = new Color(0.0f, 0.0f, 0.0f, 0.0f); } } StopCoroutine("Rexar"); isPlaying = false; isCopied = false; B1.GetComponent <TrailRenderer>().time = 0.0f; B1.SetActive(false); B1.GetComponent <Ball>().Dead = false; B2.GetComponent <TrailRenderer>().time = 0.0f; B2.SetActive(false); B2.GetComponent <Ball>().Dead = false; B3.SetActive(false); B3.GetComponent <TrailRenderer>().time = 0.0f; B3.GetComponent <Ball>().Dead = false; B4.SetActive(false); B4.GetComponent <TrailRenderer>().time = 0.0f; B4.GetComponent <Ball>().Dead = false; ChangeColor(0); }
// Update is called once per frame void Update() { //StateManager sm = TrackerManager.Instance.GetStateManager(); //IEnumerable<TrackableBehaviour> tbs = sm.GetActiveTrackableBehaviours(); B1.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q1.gameObject.SetActive(true); } }); B2.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q2.gameObject.SetActive(true); } }); B3.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q3.gameObject.SetActive(true); } }); B4.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q4.gameObject.SetActive(true); } }); B5.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q5.gameObject.SetActive(true); } }); BlackFade.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(false); Q1.gameObject.SetActive(false); Q2.gameObject.SetActive(false); Q3.gameObject.SetActive(false); Q4.gameObject.SetActive(false); Q5.gameObject.SetActive(false); } }); }
// Start is called before the first frame update void Start() { bsc = bs.GetComponent <Text>(); wsc = ws.GetComponent <Text>(); winner = win.GetComponent <Text>(); rbb = new Rigidbody[5]; rbw = new Rigidbody[5]; scb = new Shoot_Black[5]; scw = new Shoot_White[5]; rbb[0] = B0.GetComponent <Rigidbody>(); rbb[1] = B1.GetComponent <Rigidbody>(); rbb[2] = B2.GetComponent <Rigidbody>(); rbb[3] = B3.GetComponent <Rigidbody>(); rbb[4] = B4.GetComponent <Rigidbody>(); rbw[0] = W0.GetComponent <Rigidbody>(); rbw[1] = W1.GetComponent <Rigidbody>(); rbw[2] = W2.GetComponent <Rigidbody>(); rbw[3] = W3.GetComponent <Rigidbody>(); rbw[4] = W4.GetComponent <Rigidbody>(); scb[0] = B0.GetComponent <Shoot_Black>(); scb[1] = B1.GetComponent <Shoot_Black>(); scb[2] = B2.GetComponent <Shoot_Black>(); scb[3] = B3.GetComponent <Shoot_Black>(); scb[4] = B4.GetComponent <Shoot_Black>(); scw[0] = W0.GetComponent <Shoot_White>(); scw[1] = W1.GetComponent <Shoot_White>(); scw[2] = W2.GetComponent <Shoot_White>(); scw[3] = W3.GetComponent <Shoot_White>(); scw[4] = W4.GetComponent <Shoot_White>(); for (int i = 0; i < 5; i++) { rbb[i].velocity = Vector3.zero; rbw[i].velocity = Vector3.zero; rbb[i].rotation = Quaternion.Euler(new Vector3(0, 0, 0)); rbw[i].rotation = Quaternion.Euler(new Vector3(0, 0, 0)); scb[i].alive = true; scw[i].alive = true; } rbb[0].position = new Vector3(-12.5f, 1f, 13f); rbb[1].position = new Vector3(-6f, 1f, 6.5f); rbb[2].position = new Vector3(-12.5f, 1f, 0f); rbb[3].position = new Vector3(-6f, 1f, -6.5f); rbb[4].position = new Vector3(-12.5f, 1f, -13f); rbw[0].position = new Vector3(12.5f, 1f, -13f); rbw[1].position = new Vector3(6f, 1f, -6.5f); rbw[2].position = new Vector3(12.5f, 1f, 0f); rbw[3].position = new Vector3(6f, 1f, 6.5f); rbw[4].position = new Vector3(12.5f, 1f, 13f); turnnum = 0; win.transform.position = new Vector3(Screen.width / 2, Screen.height + 500, 0); }
// Use this for initialization void Awake() { //Speed = 0.0f; isPlaying = false; isCopied = false; //StartCoroutine ("Updat"); Rb1 = B1.GetComponent <Rigidbody2D> (); Rb2 = B2.GetComponent <Rigidbody2D> (); Rb3 = B3.GetComponent <Rigidbody2D> (); Rb4 = B4.GetComponent <Rigidbody2D> (); Tr1 = B1.transform; Tr2 = B2.transform; Tr3 = B3.transform; Tr4 = B4.transform; Pos1 = Out1.transform.position; Pos2 = Out2.transform.position; Pos3 = Out3.transform.position; Pos4 = Out4.transform.position; S = GetComponent <SpriteRenderer> (); }
// Use this for initialization void Awake() { //GameObject[] Balls = new GameObject[3]; isPlaying = false; isCopied = false; //StartCoroutine ("Updat"); Rb1 = B1.GetComponent <Rigidbody2D> (); Rb2 = B2.GetComponent <Rigidbody2D> (); Rb3 = B3.GetComponent <Rigidbody2D> (); Pos1 = Out1.transform.position; Pos2 = Out2.transform.position; Pos3 = Out3.transform.position; Tr1 = B1.transform; Tr2 = B2.transform; Tr3 = B3.transform; BaSc1 = B1.GetComponent <Ball> (); BaSc2 = B2.GetComponent <Ball> (); BaSc3 = B3.GetComponent <Ball> (); Tra1 = B1.GetComponent <TrailRenderer> (); Tra2 = B2.GetComponent <TrailRenderer> (); Tra3 = B3.GetComponent <TrailRenderer> (); S = GetComponent <SpriteRenderer> (); }
IEnumerator Rexar(int Layer, Collider2D other) { B1.SetActive(true); B1.transform.position = Pos1; B1.layer = Layer; B1.GetComponent <Ball> ().Direction = Direction1; B2.SetActive(true); B2.transform.position = Pos2; B2.layer = Layer; B2.GetComponent <Ball> ().Direction = Direction2; B3.SetActive(true); B3.transform.position = Pos3; B3.layer = Layer; B3.GetComponent <Ball> ().Direction = Direction2; //Rb2 = other.GetComponent<Rigidbody2D> (); yield return(new WaitForSeconds(0.1f)); if (isChange) { if (Layer.Equals(8)) { //Debug.Log ("AAA"); for (int i = 0; i < 3; i++) { Change [i].color = new Color(0.0f, 0.0f, 0.0f, 1.0f); } } else if (Layer.Equals(9)) { for (int i = 0; i < 3; i++) { Change [i].color = new Color(230 / 255f, 0.0f, 18 / 255f, 1.0f); } } else if (Layer.Equals(10)) { for (int i = 0; i < 3; i++) { Change [i].color = new Color(0.0f, 153 / 255f, 68 / 255f, 1.0f); } } else if (Layer.Equals(11)) { for (int i = 0; i < 3; i++) { Change [i].color = new Color(249 / 255f, 230 / 255f, 47 / 255f, 1.0f); } } else if (Layer.Equals(12)) { for (int i = 0; i < 3; i++) { Change [i].color = new Color(0.0f, 71 / 255f, 157 / 255f, 1.0f); } } else if (Layer.Equals(13)) { for (int i = 0; i < 3; i++) { Change [i].color = new Color(228 / 255f, 0.0f, 180 / 255f, 1.0f); } } else if (Layer.Equals(14)) { for (int i = 0; i < 3; i++) { Change [i].color = new Color(0.0f, 160 / 255f, 233 / 255f, 1.0f); } } else if (Layer.Equals(15)) { for (int i = 0; i < 3; i++) { Change [i].color = new Color(1.0f, 1.0f, 1.0f, 1.0f); } } } Direction(); other.GetComponent <Rigidbody2D>().Sleep(); }
// Use this for initialization void Start() { PlayerIcon.GetComponent <SpriteRenderer>().enabled = true; A1.GetComponent <SpriteRenderer>().enabled = false; A2.GetComponent <SpriteRenderer>().enabled = false; A3.GetComponent <SpriteRenderer>().enabled = false; A4.GetComponent <SpriteRenderer>().enabled = false; A5.GetComponent <SpriteRenderer>().enabled = false; A6.GetComponent <SpriteRenderer>().enabled = false; A7.GetComponent <SpriteRenderer>().enabled = false; A8.GetComponent <SpriteRenderer>().enabled = false; A9.GetComponent <SpriteRenderer>().enabled = false; A10.GetComponent <SpriteRenderer>().enabled = false; A11.GetComponent <SpriteRenderer>().enabled = false; B1.GetComponent <SpriteRenderer>().enabled = false; B2.GetComponent <SpriteRenderer>().enabled = false; B3.GetComponent <SpriteRenderer>().enabled = false; B4.GetComponent <SpriteRenderer>().enabled = false; B5.GetComponent <SpriteRenderer>().enabled = false; B6.GetComponent <SpriteRenderer>().enabled = false; B7.GetComponent <SpriteRenderer>().enabled = false; B8.GetComponent <SpriteRenderer>().enabled = false; B9.GetComponent <SpriteRenderer>().enabled = false; B10.GetComponent <SpriteRenderer>().enabled = false; B11.GetComponent <SpriteRenderer>().enabled = false; C1.GetComponent <SpriteRenderer>().enabled = false; C2.GetComponent <SpriteRenderer>().enabled = false; C3.GetComponent <SpriteRenderer>().enabled = false; C4.GetComponent <SpriteRenderer>().enabled = false; C5.GetComponent <SpriteRenderer>().enabled = false; C6.GetComponent <SpriteRenderer>().enabled = false; C7.GetComponent <SpriteRenderer>().enabled = false; C8.GetComponent <SpriteRenderer>().enabled = false; C9.GetComponent <SpriteRenderer>().enabled = false; C10.GetComponent <SpriteRenderer>().enabled = false; C11.GetComponent <SpriteRenderer>().enabled = false; D1.GetComponent <SpriteRenderer>().enabled = false; D2.GetComponent <SpriteRenderer>().enabled = false; D3.GetComponent <SpriteRenderer>().enabled = false; D4.GetComponent <SpriteRenderer>().enabled = false; D5.GetComponent <SpriteRenderer>().enabled = false; D6.GetComponent <SpriteRenderer>().enabled = false; D7.GetComponent <SpriteRenderer>().enabled = false; D8.GetComponent <SpriteRenderer>().enabled = false; D9.GetComponent <SpriteRenderer>().enabled = false; D10.GetComponent <SpriteRenderer>().enabled = false; D11.GetComponent <SpriteRenderer>().enabled = false; E1.GetComponent <SpriteRenderer>().enabled = false; E2.GetComponent <SpriteRenderer>().enabled = false; E3.GetComponent <SpriteRenderer>().enabled = false; E4.GetComponent <SpriteRenderer>().enabled = false; E5.GetComponent <SpriteRenderer>().enabled = false; E6.GetComponent <SpriteRenderer>().enabled = false; E7.GetComponent <SpriteRenderer>().enabled = false; E8.GetComponent <SpriteRenderer>().enabled = false; E9.GetComponent <SpriteRenderer>().enabled = false; E10.GetComponent <SpriteRenderer>().enabled = false; E11.GetComponent <SpriteRenderer>().enabled = false; F1.GetComponent <SpriteRenderer>().enabled = false; F2.GetComponent <SpriteRenderer>().enabled = false; F3.GetComponent <SpriteRenderer>().enabled = false; F4.GetComponent <SpriteRenderer>().enabled = false; F5.GetComponent <SpriteRenderer>().enabled = false; F6.GetComponent <SpriteRenderer>().enabled = false; F7.GetComponent <SpriteRenderer>().enabled = false; F8.GetComponent <SpriteRenderer>().enabled = false; F9.GetComponent <SpriteRenderer>().enabled = false; F10.GetComponent <SpriteRenderer>().enabled = false; F11.GetComponent <SpriteRenderer>().enabled = false; G1.GetComponent <SpriteRenderer>().enabled = false; G2.GetComponent <SpriteRenderer>().enabled = false; G3.GetComponent <SpriteRenderer>().enabled = false; G4.GetComponent <SpriteRenderer>().enabled = false; G5.GetComponent <SpriteRenderer>().enabled = false; G6.GetComponent <SpriteRenderer>().enabled = false; G7.GetComponent <SpriteRenderer>().enabled = false; G8.GetComponent <SpriteRenderer>().enabled = false; G9.GetComponent <SpriteRenderer>().enabled = false; G10.GetComponent <SpriteRenderer>().enabled = false; G11.GetComponent <SpriteRenderer>().enabled = false; H1.GetComponent <SpriteRenderer>().enabled = false; H2.GetComponent <SpriteRenderer>().enabled = false; H3.GetComponent <SpriteRenderer>().enabled = false; H4.GetComponent <SpriteRenderer>().enabled = false; H5.GetComponent <SpriteRenderer>().enabled = false; H6.GetComponent <SpriteRenderer>().enabled = false; H7.GetComponent <SpriteRenderer>().enabled = false; H8.GetComponent <SpriteRenderer>().enabled = false; H9.GetComponent <SpriteRenderer>().enabled = false; H10.GetComponent <SpriteRenderer>().enabled = false; H11.GetComponent <SpriteRenderer>().enabled = false; I1.GetComponent <SpriteRenderer>().enabled = false; I2.GetComponent <SpriteRenderer>().enabled = false; I3.GetComponent <SpriteRenderer>().enabled = false; I4.GetComponent <SpriteRenderer>().enabled = false; I5.GetComponent <SpriteRenderer>().enabled = false; I6.GetComponent <SpriteRenderer>().enabled = false; I7.GetComponent <SpriteRenderer>().enabled = false; I8.GetComponent <SpriteRenderer>().enabled = false; I9.GetComponent <SpriteRenderer>().enabled = false; I10.GetComponent <SpriteRenderer>().enabled = false; I11.GetComponent <SpriteRenderer>().enabled = false; J1.GetComponent <SpriteRenderer>().enabled = false; J2.GetComponent <SpriteRenderer>().enabled = false; J3.GetComponent <SpriteRenderer>().enabled = false; J4.GetComponent <SpriteRenderer>().enabled = false; J5.GetComponent <SpriteRenderer>().enabled = false; J6.GetComponent <SpriteRenderer>().enabled = false; J7.GetComponent <SpriteRenderer>().enabled = false; J8.GetComponent <SpriteRenderer>().enabled = false; J9.GetComponent <SpriteRenderer>().enabled = false; J10.GetComponent <SpriteRenderer>().enabled = false; J11.GetComponent <SpriteRenderer>().enabled = false; K1.GetComponent <SpriteRenderer>().enabled = false; K2.GetComponent <SpriteRenderer>().enabled = false; K3.GetComponent <SpriteRenderer>().enabled = false; K4.GetComponent <SpriteRenderer>().enabled = false; K5.GetComponent <SpriteRenderer>().enabled = false; K6.GetComponent <SpriteRenderer>().enabled = false; K7.GetComponent <SpriteRenderer>().enabled = false; K8.GetComponent <SpriteRenderer>().enabled = false; K9.GetComponent <SpriteRenderer>().enabled = false; K10.GetComponent <SpriteRenderer>().enabled = false; K11.GetComponent <SpriteRenderer>().enabled = false; float ratio = Screen.width / Screen.height; if (ratio < 2) { int screenx = 543; int screeny = 653; } else { int screenx = 743; int screeny = 853; } }
IEnumerator Rexar(int Layer, Collider2D other) { B1.SetActive(true); Tr1.position = Pos1; B1.layer = Layer; B1.GetComponent <Ball> ().Direction = Direction1; B2.SetActive(true); Tr2.position = Pos2; B2.layer = Layer; B2.GetComponent <Ball> ().Direction = Direction2; //Rb2 = other.GetComponent<Rigidbody2D> (); B3.SetActive(true); Tr3.position = Pos3; B3.layer = Layer; B3.GetComponent <Ball> ().Direction = Direction2; B4.SetActive(true); Tr4.position = Pos4; B4.layer = Layer; B4.GetComponent <Ball> ().Direction = Direction2; B5.SetActive(true); Tr5.position = Pos5; B5.layer = Layer; B5.GetComponent <Ball> ().Direction = Direction2; yield return(new WaitForSeconds(0.1f)); Rb1.Sleep(); B1.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Rb2.Sleep(); B2.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Rb3.Sleep(); B3.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Rb4.Sleep(); B4.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Rb5.Sleep(); B5.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Tr1.position = Pos1; Tr2.position = Pos2; Tr3.position = Pos3; Tr4.position = Pos4; Tr5.position = Pos5; if (Direction1.Equals(1)) { Rb1.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction1.Equals(2)) { Rb1.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction1.Equals(3)) { Rb1.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction1.Equals(4)) { Rb1.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction1.Equals(8)) { Rb1.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction1.Equals(7)) { Rb1.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction1.Equals(6)) { Rb1.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction1.Equals(5)) { Rb1.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction1.Equals(9)) { Rb1.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction1.Equals(10)) { Rb1.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction1.Equals(11)) { Rb1.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction1.Equals(12)) { Rb1.AddForce(V * new Vector2(178.9869f, -89.24f)); } if (Direction2.Equals(1)) { Rb2.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction2.Equals(2)) { Rb2.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction2.Equals(3)) { Rb2.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction2.Equals(4)) { Rb2.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction2.Equals(6)) { Rb2.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction2.Equals(7)) { Rb2.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction2.Equals(8)) { Rb2.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction2.Equals(5)) { Rb2.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction2.Equals(9)) { Rb2.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction2.Equals(10)) { Rb2.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction2.Equals(11)) { Rb2.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction2.Equals(12)) { Rb2.AddForce(V * new Vector2(178.9869f, -89.24f)); } if (Direction3.Equals(1)) { Rb3.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction3.Equals(2)) { Rb3.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction3.Equals(3)) { Rb3.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction3.Equals(4)) { Rb3.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction3.Equals(6)) { Rb3.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction3.Equals(7)) { Rb3.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction3.Equals(8)) { Rb3.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction3.Equals(5)) { Rb3.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction3.Equals(9)) { Rb1.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction3.Equals(10)) { Rb3.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction3.Equals(11)) { Rb3.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction3.Equals(12)) { Rb3.AddForce(V * new Vector2(178.9869f, -89.24f)); } if (Direction4.Equals(1)) { Rb4.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction4.Equals(2)) { Rb4.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction4.Equals(3)) { Rb4.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction4.Equals(4)) { Rb4.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction4.Equals(6)) { Rb4.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction4.Equals(7)) { Rb4.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction4.Equals(8)) { Rb4.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction4.Equals(5)) { Rb4.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction4.Equals(9)) { Rb4.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction4.Equals(10)) { Rb4.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction4.Equals(11)) { Rb4.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction4.Equals(12)) { Rb4.AddForce(V * new Vector2(178.9869f, -89.24f)); } if (Direction5.Equals(1)) { Rb5.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction5.Equals(2)) { Rb5.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction5.Equals(3)) { Rb5.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction5.Equals(4)) { Rb5.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction5.Equals(6)) { Rb5.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction5.Equals(7)) { Rb5.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction5.Equals(8)) { Rb5.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction5.Equals(5)) { Rb5.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction5.Equals(9)) { Rb5.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction5.Equals(10)) { Rb5.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction5.Equals(11)) { Rb5.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction5.Equals(12)) { Rb5.AddForce(V * new Vector2(178.9869f, -89.24f)); } B1.GetComponent <Ball> ().Direction = Direction1; B2.GetComponent <Ball> ().Direction = Direction2; B3.GetComponent <Ball> ().Direction = Direction3; B4.GetComponent <Ball> ().Direction = Direction4; B5.GetComponent <Ball> ().Direction = Direction5; other.GetComponent <Rigidbody2D>().Sleep(); }
// Update is called once per frame void Update() { //StateManager sm = TrackerManager.Instance.GetStateManager(); //IEnumerable<TrackableBehaviour> tbs = sm.GetActiveTrackableBehaviours(); B1.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q1.gameObject.SetActive(true); } }); B2.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q2.gameObject.SetActive(true); } }); B3.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q3.gameObject.SetActive(true); } }); B4.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q4.gameObject.SetActive(true); } }); B5.GetComponent <Button> ().onClick.AddListener(delegate { if (click) { BlackFade.gameObject.SetActive(true); Q5.gameObject.SetActive(true); } }); /*BlackFade.GetComponent<Button> ().onClick.AddListener (delegate { * if (click) { * BlackFade.gameObject.SetActive (false); * Q1.gameObject.SetActive (false); * Q2.gameObject.SetActive (false); * Q3.gameObject.SetActive (false); * Q4.gameObject.SetActive (false); * Q5.gameObject.SetActive (false); * } * });*/ /*foreach (TrackableBehaviour tb in tbs) * { * string name = tb.TrackableName; * ImageTarget it = tb.Trackable as ImageTarget; * Vector2 size = it.GetSize(); * * Debug.Log("Active image target:" + name + " -size: " + size.x + ", " + size.y); * * }*/ }
IEnumerator Rexar(int Layer, Collider2D other) { B1.SetActive(true); Tr1.position = Pos1; B1.layer = Layer; B1.GetComponent <Ball> ().Direction = Direction1; B2.SetActive(true); Tr2.position = Pos2; B2.layer = Layer; B2.GetComponent <Ball> ().Direction = Direction2; //Rb2 = other.GetComponent<Rigidbody2D> (); B3.SetActive(true); Tr3.position = Pos3; B3.layer = Layer; B3.GetComponent <Ball> ().Direction = Direction2; B4.SetActive(true); Tr4.position = Pos4; B4.layer = Layer; B4.GetComponent <Ball> ().Direction = Direction2; yield return(new WaitForSeconds(0.1f)); if (isChange) { if (Layer.Equals(8)) { //Debug.Log ("AAA"); for (int i = 0; i < 4; i++) { Change [i].color = new Color(0.0f, 0.0f, 0.0f, 1.0f); } } else if (Layer.Equals(9)) { for (int i = 0; i < 4; i++) { Change [i].color = new Color(230 / 255f, 0.0f, 18 / 255f, 1.0f); } } else if (Layer.Equals(10)) { for (int i = 0; i < 4; i++) { Change [i].color = new Color(0.0f, 153 / 255f, 68 / 255f, 1.0f); } } else if (Layer.Equals(11)) { for (int i = 0; i < 4; i++) { Change [i].color = new Color(249 / 255f, 230 / 255f, 47 / 255f, 1.0f); } } else if (Layer.Equals(12)) { for (int i = 0; i < 4; i++) { Change [i].color = new Color(0.0f, 71 / 255f, 157 / 255f, 1.0f); } } else if (Layer.Equals(13)) { for (int i = 0; i < 4; i++) { Change [i].color = new Color(228 / 255f, 0.0f, 180 / 255f, 1.0f); } } else if (Layer.Equals(14)) { for (int i = 0; i < 4; i++) { Change [i].color = new Color(0.0f, 160 / 255f, 233 / 255f, 1.0f); } } else if (Layer.Equals(15)) { for (int i = 0; i < 4; i++) { Change [i].color = new Color(1.0f, 1.0f, 1.0f, 1.0f); } } } Rb1.Sleep(); B1.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Rb2.Sleep(); B2.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Rb3.Sleep(); B3.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Rb4.Sleep(); B4.GetComponent <TrailRenderer> ().time = Mathf.Infinity; Tr1.position = Pos1; Tr2.position = Pos2; Tr3.position = Pos3; Tr4.position = Pos4; if (Direction1.Equals(1)) { Rb1.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction1.Equals(2)) { Rb1.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction1.Equals(3)) { Rb1.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction1.Equals(4)) { Rb1.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction1.Equals(8)) { Rb1.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction1.Equals(7)) { Rb1.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction1.Equals(6)) { Rb1.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction1.Equals(5)) { Rb1.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction1.Equals(9)) { Rb1.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction1.Equals(10)) { Rb1.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction1.Equals(11)) { Rb1.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction1.Equals(12)) { Rb1.AddForce(V * new Vector2(178.9869f, -89.24f)); } if (Direction1.Equals(13)) { Rb1.AddForce(V * new Vector2(89.24f, 178.9869f)); Tr1.position = Pos1; } if (Direction1.Equals(14)) { Rb1.AddForce(V * new Vector2(-89.24f, 178.9869f)); Tr1.position = Pos1; } if (Direction1.Equals(15)) { Rb1.AddForce(V * new Vector2(-89.24f, -178.9869f)); Tr1.position = Pos1; } if (Direction1.Equals(16)) { Rb1.AddForce(V * new Vector2(89.24f, -178.9869f)); Tr1.position = Pos1; } if (Direction2.Equals(1)) { Rb2.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction2.Equals(2)) { Rb2.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction2.Equals(3)) { Rb2.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction2.Equals(4)) { Rb2.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction2.Equals(6)) { Rb2.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction2.Equals(7)) { Rb2.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction2.Equals(8)) { Rb2.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction2.Equals(5)) { Rb2.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction2.Equals(9)) { Rb2.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction2.Equals(10)) { Rb2.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction2.Equals(11)) { Rb2.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction2.Equals(12)) { Rb2.AddForce(V * new Vector2(178.9869f, -89.24f)); } if (Direction2.Equals(13)) { Rb2.AddForce(V * new Vector2(89.24f, 178.9869f)); Tr2.position = Pos2; } if (Direction2.Equals(14)) { Rb2.AddForce(V * new Vector2(-89.24f, 178.9869f)); Tr2.position = Pos2; } if (Direction2.Equals(15)) { Rb2.AddForce(V * new Vector2(-89.24f, -178.9869f)); Tr2.position = Pos2; } if (Direction2.Equals(16)) { Rb2.AddForce(V * new Vector2(89.24f, -178.9869f)); Tr2.position = Pos2; } if (Direction3.Equals(1)) { Rb3.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction3.Equals(2)) { Rb3.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction3.Equals(3)) { Rb3.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction3.Equals(4)) { Rb3.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction3.Equals(6)) { Rb3.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction3.Equals(7)) { Rb3.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction3.Equals(8)) { Rb3.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction3.Equals(5)) { Rb3.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction3.Equals(9)) { Rb1.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction3.Equals(10)) { Rb3.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction3.Equals(11)) { Rb3.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction3.Equals(12)) { Rb3.AddForce(V * new Vector2(178.9869f, -89.24f)); } if (Direction3.Equals(13)) { Rb3.AddForce(V * new Vector2(89.24f, 178.9869f)); Tr3.position = Pos3; } if (Direction3.Equals(14)) { Rb3.AddForce(V * new Vector2(-89.24f, 178.9869f)); Tr3.position = Pos3; } if (Direction3.Equals(15)) { Rb3.AddForce(V * new Vector2(-89.24f, -178.9869f)); Tr3.position = Pos3; } if (Direction3.Equals(16)) { Rb3.AddForce(V * new Vector2(89.24f, -178.9869f)); Tr3.position = Pos3; } if (Direction4.Equals(1)) { Rb4.AddForce(V * new Vector2(200.0f, 0.0f)); } if (Direction4.Equals(2)) { Rb4.AddForce(V * new Vector2(0.0f, 200.0f)); } if (Direction4.Equals(3)) { Rb4.AddForce(V * new Vector2(-200.0f, 0.0f)); } if (Direction4.Equals(4)) { Rb4.AddForce(V * new Vector2(0.0f, -200.0f)); } if (Direction4.Equals(6)) { Rb4.AddForce(V * new Vector2(141.42f, -141.42f)); } if (Direction4.Equals(7)) { Rb4.AddForce(V * new Vector2(-141.42f, -141.42f)); } if (Direction4.Equals(8)) { Rb4.AddForce(V * new Vector2(-141.42f, 141.42f)); } if (Direction4.Equals(5)) { Rb4.AddForce(V * new Vector2(141.42f, 141.42f)); } if (Direction4.Equals(9)) { Rb4.AddForce(V * new Vector2(178.9869f, 89.24f)); } if (Direction4.Equals(10)) { Rb4.AddForce(V * new Vector2(-178.9869f, 89.24f)); } if (Direction4.Equals(11)) { Rb4.AddForce(V * new Vector2(-178.9869f, -89.24f)); } if (Direction4.Equals(12)) { Rb4.AddForce(V * new Vector2(178.9869f, -89.24f)); } if (Direction4.Equals(13)) { Rb4.AddForce(V * new Vector2(89.24f, 178.9869f)); Tr4.position = Pos4; } if (Direction4.Equals(14)) { Rb4.AddForce(V * new Vector2(-89.24f, 178.9869f)); Tr4.position = Pos4; } if (Direction4.Equals(15)) { Rb4.AddForce(V * new Vector2(-89.24f, -178.9869f)); Tr4.position = Pos4; } if (Direction4.Equals(16)) { Rb4.AddForce(V * new Vector2(89.24f, -178.9869f)); Tr4.position = Pos4; } B1.GetComponent <Ball> ().Direction = Direction1; B2.GetComponent <Ball> ().Direction = Direction2; B3.GetComponent <Ball> ().Direction = Direction3; B4.GetComponent <Ball> ().Direction = Direction4; other.GetComponent <Rigidbody2D>().Sleep(); }