protected override bool ShouldDestroySelf(Collider2D other)
 {
     if (IsValidCollision(other))
     {
         enemyData.ApplyDamage(damageDealtWhenHit);
         if (colorChanger != null)
         {
             colorChanger.ChangeColor();
         }
     }
     return(enemyData.pCurrentLives <= 0);
 }
示例#2
0
 private void TickLaser()
 {
     if (m_ClosestEnemyData == null)
     {
         m_LineRenderer.gameObject.SetActive(false);
     }
     else
     {
         m_LineRenderer.gameObject.SetActive(true);
         m_LineRenderer.SetPositions(new[] { m_View.ProjectileOrigin.transform.position, m_ClosestEnemyData.View.transform.position });
         m_ClosestEnemyData.ApplyDamage(m_Damage * Time.deltaTime);
     }
 }
 public void DestroyProjectile()
 {
     m_HitEnemy?.ApplyDamage(m_Damage);
     Destroy(gameObject);
 }