Esempio n. 1
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        PlayerController pc = other.gameObject.GetComponent <PlayerController>();

        if (!pc)
        {
            return;
        }
        LebensPunkte lp = other.gameObject.GetComponent <LebensPunkte>();

        lp.minusLebnspunkte(sp.getDamage());
        sp.minusLebnspunkte(lp.getDamage());
        this._particles.Play();
        audios.Play();
        if (sp.ifDamage())
        {
            score.addScore(bonus);
            Debug.Log(Score.score);
            this.Hit();
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Enemy enemy = other.gameObject.GetComponent <Enemy>();

        if (!enemy)
        {
            return;
        }
        audios.Play();
        LebensPunkte lp = other.gameObject.GetComponent <LebensPunkte>();

        sp.minusLebnspunkte(lp.getDamage());
        lp.minusLebnspunkte(sp.getDamage());
        if (lp.ifDamage())
        {
            enemy.Hit();
            score.addScore(bonus);
            Debug.Log(Score.score);
        }
        if (sp.ifDamage())
        {
            this.BackToPool();
        }
    }