Esempio n. 1
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (other.gameObject.CompareTag(Statics.Tags.PLAYER_OUTSIDE))
     {
         _shipHealth = null;
     }
 }
Esempio n. 2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        DamageShip damageShip = collision.transform.GetComponent <DamageShip>();

        if (damageShip != null && _canAttack)
        {
            damageShip.Hit(_damage);
            StartCoroutine(Wait());
        }
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        DamageShip shipScript = collision.transform.GetComponent <DamageShip>();

        if (shipScript != null && _waitTimer.Expired())
        {
            _waitTimer.Reset();
            shipScript.Hit(_damage);
        }
    }
Esempio n. 4
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        DamageShip damageShip = other.GetComponent <DamageShip>();

        if (damageShip != null)
        {
            damageShip.RecoverDamage(_recoverDamageAmout);
            Destroy(gameObject);
        }
    }
Esempio n. 5
0
    void Start()
    {
        _damageShipScript = GameManager.ShipObject.GetComponent <DamageShip>();
        _lightShipScript  = GameManager.ShipObject.GetComponent <LightShip>();
        _moveShipScript   = GameManager.ShipObject.GetComponent <MoveShip>();
        _damageShipScript.ShipTakeDamageEvent += OnHealthChange;
        _lightShipScript.ShipUsedFlareEvent   += OnFlare;
        _moveShipScript.ShipSoundEvent        += OnNoiseChange;

        _originalHealthBarColor = _healthBarImage.color;
    }
Esempio n. 6
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag(Statics.Tags.PLAYER_OUTSIDE))
     {
         if (_soundPlayer != null)
         {
             _soundPlayer.Play();
         }
         _shipHealth = other.gameObject.GetComponent <DamageShip>();
     }
 }