/// <summary> /// 耐久値を減らす /// </summary> /// <param name="power"></param> private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Ball") { m_CurrentEndurance -= collision.gameObject.GetComponent <BallController>().GetPowor(); // 耐久値が0以下なら破壊 if (m_CurrentEndurance <= 0) { m_isDead = true; MainSystem.AddScore(m_Zonbie.GetScore()); GetComponent <BoxCollider>().enabled = false; GetComponent <NavMeshAgent>().enabled = false; // 血痕生成 var pos = transform.position; pos.y = BLOOD_POSITION_Y; Instantiate(m_listBloodPrefabs[Random.Range(0, m_listBloodPrefabs.Count)], pos, Quaternion.identity, m_Bloods); if (m_Bloods.childCount > 100) { Destroy(m_Bloods.GetChild(0).gameObject); } // パーティクル動作 transform.GetChild(0).GetComponent <ParticleSystem>().Play(); Destroy(transform.GetChild(1).gameObject); Destroy(gameObject, 1.0f); if (!MainSystem.m_isGameOver) { SEManager.Instance.Play(SEPath.ATTACK); } } } }