private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "onigiri") { Destroy(collision.gameObject); collision.gameObject.tag = "not_onigiri"; //加速 speed += 0.2f; animator.SetFloat("Speed", speed); gravity += 0.2f; rg.gravityScale = gravity; move_speed_UCS += 1.8f; // //UI CTS.change_Text(speedup_text.textComponent, "スピードアップ!"); CTS.change_color(speedup_text.textComponent, textColor.yellow); StartCoroutine(CTS.FalseUI(2.0f, speedup_text.textComponent)); } if (collision.gameObject.tag == "bomb" || collision.gameObject.tag == "rock") { Destroy(collision.gameObject); StartCoroutine("WaitFlash");//点滅用コルーチン //減速 speed -= 0.4f; if (speed < 0.2f) { speed = 0.2f; } animator.SetFloat("Speed", speed); gravity -= 0.2f; if (gravity < 3.0f) { gravity = 3.0f; } collision.gameObject.tag = "not_bomb"; move_speed_UCS -= 3.6f; if (move_speed_UCS < 1.8f) { move_speed_UCS = 1.8f; } // //UI CTS.change_Text(speeddown_text.textComponent, "スピードダウン…"); CTS.change_color(speeddown_text.textComponent, textColor.red); StartCoroutine(CTS.FalseUI(2.0f, speeddown_text.textComponent)); } }
//爆弾破壊時のUI public void PlusTimeUI() { //UI CTS.change_Text(plustime_text.textComponent, "+3秒!"); CTS.change_color(plustime_text.textComponent, textColor.green); StartCoroutine(CTS.FalseUI(2.0f, plustime_text.textComponent)); }