// Update is called once per frame void Update() { if (GameObject.Find("Player").transform.position.x >= -46.5f && GameObject.Find("Player").transform.position.y <= 51.2f && GameObject.Find("Player").transform.position.y >= 50f) { BackButton.OnTap(); } }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.name == "Player") { BackButton.OnTap(); } }
// Update is called once per frame void Update() { if (transform.position.y >= 19.2f) { transform.position = new Vector2(transform.position.x, 19.2f); } if (CollectibleTeleport.tpWater == true) { if (hasTpd == false) { transform.position = new Vector2(transform.position.x, tpY); hasTpd = true; } } if (hasTpd == false) { transform.Translate(Vector2.up / startSpeed); } if (hasTpd == true) { transform.Translate(Vector2.up / tpSpeed); } if (transform.position.y - GameObject.Find("Player").transform.position.y >= -5.9f) { BackButton.OnTap(); } }
// Update is called once per frame void Update() { if (GameObject.Find("Player").transform.position.y <= dis) { BackButton.OnTap(); } }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.name == "Player") { BackButton.OnTap(); } }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.name == "Player") { PlayerPrefs.SetInt(SceneManager.GetActiveScene().name.ToString() + "Finish", 1); BackButton.OnTap(); } }
// Update is called once per frame void Update() { if (GameObject.Find("MovingFloor").transform.position.y >= border) { if (hasHit == true && UpDownPlatform.hasHit == true) { BackButton.OnTap(); } } }
// Update is called once per frame void Update() { if (WaterFloor.tpWater == true) { if (transform.position.y - GameObject.Find("Player").transform.position.y >= waterDistance) { BackButton.OnTap(); } if (transform.position.y <= waterLevel) { transform.Translate(Vector2.up / risingSpeed); } } }
// Update is called once per frame void Update() { if (transform.position.y >= 0f) { transform.position = new Vector2(transform.position.x, 0f); } if (WaterFloor.tpWater == true) { if (hasTpd == false) { transform.DOMove(tpPos, 1); hasTpd = true; } } if (hasTpd == true) { transform.Translate(Vector2.up / tpSpeed); } if (transform.position.y - GameObject.Find("Player").transform.position.y >= -5.9f) { BackButton.OnTap(); } }
// Update is called once per frame void Update() { //Debug.Log ("col " + colName); //Debug.Log ("jump " + jumpName); if (transform.position.y <= -5) { BackButton.OnTap(); } if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0) { PlayerPrefs.SetString("InputMode", "controller"); } if (Input.touchCount > 0) { PlayerPrefs.SetString("InputMode", "phone"); } if (PlayerPrefs.GetString("InputMode") == "phone") { AxZ = Input.acceleration.x; if (Input.acceleration.x != 0) { coll.sharedMaterial.friction = 0; } if (Input.acceleration.x <= 0.15f && Input.acceleration.x >= -0.15f) { AxZ = 0; } if (AxZ >= 0.7f) { AxZ = 0.7f; } if (AxZ <= -0.7f) { AxZ = -0.7f; } rb.AddForce(Vector2.right * 50 * AxZ); } vel = rb.velocity; if (PlayerPrefs.GetString("InputMode") == "controller") { if (Input.GetAxis("Horizontal") > 0) { coll.sharedMaterial.friction = 0.15f; rb.AddForce(Vector2.right * moveSpeed); } if (Input.GetAxis("Horizontal") < 0) { rb.AddForce(Vector2.right * -moveSpeed); coll.sharedMaterial.friction = 0.15f; } } if (rb.velocity.y < 0) { hasLanded = false; } if (rb.velocity.y == 0) { if (hasLanded == false) { if (PlayerPrefs.GetInt("Sound") == 1) { AudioCenter.playSound(landSound); } hasLanded = true; } } //transform.Translate (Input.GetAxis ("Horizontal") / 10, 0, 0, Space.World); //transform.Translate (new Vector3 (AxZ, 0, 0), Space.World) if (transform.position.x <= 15 || transform.position.y >= 12) { if (vel.x >= 6) { vel.x = 6; } if (vel.x <= -6) { vel.x = -6; } rb.gravityScale = 1; Debug.Log("Land"); if (colName != "RightFloor" && colName != "LeftFloor") { if (rb.velocity.y == 0 || UpDownPlatform.collisioncount == 1) { if (PlayerPrefs.GetString("InputMode") == "controller") { if (Input.GetButtonDown("Jump")) { Jump(); } } if (PlayerPrefs.GetString("InputMode") == "phone") { for (int i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase == TouchPhase.Began) { Jump(); } } } } } if (colName == "RightFloor" || colName == "LeftFloor") { if (colName != jumpName) { if (PlayerPrefs.GetString("InputMode") == "controller") { if (Input.GetButtonDown("Jump")) { Jump(); } } if (PlayerPrefs.GetString("InputMode") == "phone") { for (int i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase == TouchPhase.Began) { Jump(); } } } } } } else { if (vel.x >= 4) { vel.x = 4; } if (vel.x <= -4) { vel.x = -4; } if (vel.y <= -4) { vel.y = -4; } rb.gravityScale = 0.2f; Debug.Log("Water"); if (PlayerPrefs.GetString("InputMode") == "controller") { if (Input.GetButton("Jump")) { WaterJump(); } } if (PlayerPrefs.GetString("InputMode") == "phone") { for (int i = 0; i < Input.touchCount; ++i) { WaterJump(); } } } rb.velocity = vel; }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.name == "Player") { if (SceneManager.GetActiveScene().name == "Scene1") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQEA", (bool success) => { }); Social.ReportProgress("CgkI9oaq2dELEAIQAQ", 100.0f, (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene2") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQEQ", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene3") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQEg", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene4") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQEw", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene5") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQFA", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene6") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQFQ", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene7") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQFg", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene9") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQGA", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene10") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQGQ", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene11") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQGg", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene12") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQGw", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene13") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQHA", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene14") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQHQ", (bool success) => { }); } if (SceneManager.GetActiveScene().name == "Scene15") { Social.ReportScore((long)(timer * 1000), "CgkI9oaq2dELEAIQHg", (bool success) => { }); Social.ReportProgress("CgkI9oaq2dELEAIQDw", 0.0f, (bool success) => { }); } hasHit = true; PlayerPrefs.SetInt(SceneManager.GetActiveScene().name.ToString() + "Finish", 1); BackButton.OnTap(); } }
// Update is called once per frame void Update() { timer += Time.deltaTime; if (transform.position.y <= -71) { BackButton.OnTap(); } //Debug.Log ("col " + colName); //Debug.Log ("jump " + jumpName); if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0) { PlayerPrefs.SetString("InputMode", "controller"); } if (Input.touchCount > 0) { PlayerPrefs.SetString("InputMode", "phone"); } if (PlayerPrefs.GetString("InputMode") == "phone") { AxZ = Input.acceleration.x / 2; if (Input.acceleration.x != 0) { coll.sharedMaterial.friction = 0; } if (Input.acceleration.x <= 0.2f && Input.acceleration.x >= -0.2f) { AxZ = 0; } if (AxZ >= 0.7f) { AxZ = 0.7f; } if (AxZ <= -0.7f) { AxZ = -0.7f; } rb.AddForce(Vector2.right * 65 * AxZ); } vel = rb.velocity; if (vel.x >= 6) { vel.x = 6; } if (vel.x <= -6) { vel.x = -6; } rb.velocity = vel; if (PlayerPrefs.GetString("InputMode") == "controller") { if (Input.GetAxis("Horizontal") > 0) { coll.sharedMaterial.friction = 0.15f; rb.AddForce(Vector2.right * moveSpeed); } if (Input.GetAxis("Horizontal") < 0) { rb.AddForce(Vector2.right * -moveSpeed); coll.sharedMaterial.friction = 0.15f; } } if (rb.velocity.y < 0) { hasLanded = false; } if (rb.velocity.y == 0) { if (hasLanded == false) { hasLanded = true; } } //transform.Translate (Input.GetAxis ("Horizontal") / 10, 0, 0, Space.World); //transform.Translate (new Vector3 (AxZ, 0, 0), Space.World) if (colName == "RightFloor" || colName == "LeftFloor") { if (colName != jumpName) { if (PlayerPrefs.GetString("InputMode") == "controller") { if (Input.GetButtonDown("Jump") || Input.GetButtonDown("Submit")) { Jump(); } } if (PlayerPrefs.GetString("InputMode") == "phone") { for (int i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase == TouchPhase.Began) { Jump(); } } } } } if (colName != "RightFloor" && colName != "LeftFloor") { if (rb.velocity.y == 0 || UpDownPlatform.collisioncount == 1 || FallingPlatform.collisioncount == 1) { if (PlayerPrefs.GetString("InputMode") == "controller") { if (Input.GetButtonDown("Jump") || Input.GetButtonDown("Submit")) { Jump(); } } if (PlayerPrefs.GetString("InputMode") == "phone") { for (int i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase == TouchPhase.Began) { Jump(); } } } } } }