private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.name == "Ball") { hp -= MoveBall.damageBall; if (hp > 0) { collision.gameObject.GetComponent <AudioSource>().volume = 1f; collision.gameObject.GetComponent <AudioSource>().PlayOneShot(destroy); CreateLineBlocks.CheckOffset(Move.countHit++); } else { collision.gameObject.GetComponent <AudioSource>().volume = 0.7f; collision.gameObject.GetComponent <AudioSource>().PlayOneShot(allDestroy); CreateLineBlocks.CheckOffset(Move.countHit++); } } }
void Update() { BlockStatus(); if (hp <= 0) { if (SceneManager.GetActiveScene().name == "SampleScene")// см. выше { CreateLineBlocks.BlockInLinesRemove(numberLine, gameObject); } if (Move.isBonusScore == true) { TextView txtView = new TextView((BlockValue * 2).ToString(), gameObject.transform.position); txtView.moveText(); Score.score += BlockValue * 2; } else { TextView txtView = new TextView(BlockValue.ToString(), gameObject.transform.position); txtView.moveText(); Score.score += BlockValue; } spavnBonus(); Destroy(gameObject); if (SceneManager.GetActiveScene().buildIndex == 1 && Score.score % 10 == 0) { if (Score.score <= 100) { MoveBall.BallSpeed += 0.1f; //Score.score / 20; Debug.Log("move is " + MoveBall.BallSpeed); } else { MoveBall.BallSpeed += 0.05f; //Score.score / 1000; } } if (SceneManager.GetActiveScene().buildIndex == 1) { if ((Score.score >= 100) && (Score.score < 200) && (hpupnum == 0)) { lowLimitHP += 1; Debug.Log("test is ok"); hpupnum += 1; Debug.Log("hpupnum = " + hpupnum); //upLimitHP += 1; } else if (Score.score >= 200 && Score.score < 300 && hpupnum == 1) { lowLimitHP += 1; hpupnum += 1; } else if (Score.score >= 300 && Score.score < 400 && hpupnum == 2) { upLimitHP += 1; hpupnum += 1; } else if (Score.score >= 400 && Score.score < 500 && hpupnum == 3) { lowLimitHP += 1; } } blocks = GameObject.FindGameObjectsWithTag("Block").Length - 1; Debug.Log(blocks); } }