Example #1
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        Enemy2D enemy  = hitInfo.GetComponent <Enemy2D>();
        Cherry  cherry = hitInfo.GetComponent <Cherry>();

        if (enemy != null)
        {
            enemy.TakeDamage(damage);
        }
        if (cherry)
        {
            cherry.Remove();
        }
        Destroy(gameObject);
    }
Example #2
0
    public IEnumerator BreakCor(Enemy2D enemy)
    {
        enemy.mover.StopMove();
        enemy.isBusy = true;

        // направление
        enemy.mover.RotateTo(transform.position);

        yield return(new WaitForSeconds(HatchList.Instance.BreakTime));

        if (enemy != null)
        {
            enemy.mover.RestoreMove();
            enemy.isBusy = false;

            TakeDamage();
        }
    }
Example #3
0
    private IEnumerator EnemyDeadCor(float time, Enemy2D enemy)
    {
        yield return(new WaitForSeconds(time));

        enemy?.Dead(false);
    }