Exemple #1
0
    private void OnTriggerEnter(Collider collider)
    {
        PlayerHealth playerHealth = collider.GetComponent <PlayerHealth>();

        if (playerHealth != null)
        {
            playerHealth.Kill();
        }

        DestructibleObjects destructibleObjects = collider.GetComponent <DestructibleObjects>();

        if (destructibleObjects != null)
        {
            destructibleObjects.Damage(_DamageAmount);
        }

        if (collider.GetComponent <APowerup>() != null || collider.GetComponent <Pickup>() != null)
        {
            Destroy(collider.gameObject);
        }

        ABomb bomb = collider.GetComponent <ABomb>();

        if (bomb != null)
        {
            bomb.Explode();
        }
    }
 public void Initialize()
 {
     BombPrefab          = _BombPrefab;
     Ammo                = _Ammo;
     ExplosionTime       = _ExplosionTime;
     ExplosionPrefab     = _ExplosionPrefab;
     ExplosionRadius     = _ExplosionRadius;
     ExplosionDirections = _ExplosionDirections;
 }
Exemple #3
0
 public void Fire()
 {
     if (_BombAttackStats.Ammo > 0 && CanFireBomb)
     {
         ABomb bomb = Instantiate(_BombAttackStats.BombPrefab, transform.position, Quaternion.identity);
         bomb.Initialize(this, _BombAttackStats);
         --_BombAttackStats.Ammo;
     }
     BombFiredEvent.Invoke();
 }
 public void ResetBomb()
 {
     BombPrefab = _BombPrefab;
 }