public override void Play(ShootHelper user) { AudioHandler audioHandler = user.shooter.GetComponent <AudioHandler>(); audioHandler.PlaySound("Shield"); Ray shieldDirection = user.GetOffsetRay(); ShotObject shotBullet = Instantiate(m_shieldPrefab, shieldDirection.origin + user.m_bulletSpawnPoint.rotation * m_shieldPositionOffset, Quaternion.LookRotation(shieldDirection.direction)); shotBullet.shooter = user.shooter; shotBullet.m_lifeTime = m_shieldLifeTime; }
void OnTriggerEnter(Collider other) { if (shooter != null && other.transform != shooter) { Health otherHealth = other.transform.GetComponent <Health>(); if (otherHealth != null) { otherHealth.TakeDamage(m_damage); } ShotObject otherShotObject = other.transform.GetComponent <ShotObject>(); if (otherShotObject == null || otherShotObject.shooter != shooter) { Destroy(gameObject); } } else { Destroy(gameObject); } }
// 削除用イベント void CallBackDestroy(ShotObject shot) { _shots.Remove(shot); }