private void OnTriggerEnter(Collider other) { if (other.tag == "DustBox") { //フラグ関連 Hold = false; GameOver = true; //フィールドマネージャー情報を渡す FieldManeger.Instance.PlayerGameOvers[playerNumber] = true; //爆弾を持っていたら消す Destroy(ShootObject); } if (other.tag == "Bomb") { //爆弾の位置 Vector3 BombPos = other.gameObject.transform.position; //爆弾のyの数値を合わせる そうしないと変な方向を向く BombPos.y = transform.position.y; //爆弾の方を向く transform.LookAt(BombPos); //吹っ飛ぶ力を設定 bombimpactは爆弾側で設定している Vector3 force = transform.position - (transform.forward * bombimpact); //後ろに吹っ飛ぶ rb.AddForce(force, ForceMode.Impulse); //上に吹っ飛ぶ rb.AddForce(Vector3.up * 300.0f); //振動 Pad = true; Timer = 0.5f; SwitchVibration.LowVibration(playerNumber, 0.3f); } }
void Controller() { Timer -= Time.deltaTime; if (Timer <= 0) { Pad = false; SwitchVibration.LowVibration(playerNumber, 0.0f); } }
private void OnDestroy() { SwitchVibration.LowVibration(playerNumber, 0.0f); }