Exemplo n.º 1
0
 public void Hit()
 {
     Instantiate(HitExplosion, transform.position, Quaternion.identity);
     if (!_parameters.RemoveShield())
     {
         _demolish.Demolish();
     }
 }
    private void OnTriggerEnter(Collider other)
    {
        if (!_targetTagsComponent.Contains(other.gameObject.tag))
        {
            return;
        }
        var hitObject = other.GetComponentInParent <HitScript>();

        if (hitObject != null)
        {
            hitObject.Hit();
        }
        else
        {
            var destroyable = other.GetComponentInParent <DestroyScript>();
            if (destroyable != null)
            {
                destroyable.Demolish();
            }
        }
        _destroyable.Demolish();
    }