void OnTriggerEnter(Collider other) { IDamageable <int> i_damage = other.gameObject.GetComponent <IDamageable <int> >(); if (i_damage != null) { i_damage.BlowingOff(transform.position, BOMB_FORCE); } }
void OnCollisionEnter(Collision collision) { IDamageable <int> i_damage = collision.gameObject.GetComponent <IDamageable <int> >(); if (i_damage != null) { i_damage.BlowingOff(transform.position, BOMB_FORCE); } }
public void BlowingOff(Vector3 _pos, float _power) { IDamageable <int> i_damage = callTarget.GetComponent <IDamageable <int> >(); if (i_damage != null) { i_damage.BlowingOff(_pos, _power); } }
/// <summary> /// 損傷ダメージ /// </summary> /// <param name="_damageValue">Damage value.</param> public void Damage(int _damageValue) { Instantiate(prefabExplosion, transform.position, prefabExplosion.transform.rotation); VR_AudioManager.Instance.PlaySE(AUDIO_NAME.SE_EXPLOSION, transform.position, 20.0f, 1.0f); Collider[] targets = Physics.OverlapSphere(transform.position, DAMAGE_AREA_RADUIUS); foreach (Collider obj in targets) { IDamageable <int> i_damage = obj.gameObject.GetComponent <IDamageable <int> >(); if (i_damage != null) { i_damage.BlowingOff(transform.position, BOMB_FORCE); } } Destroy(gameObject); }