Beispiel #1
0
 void checkLeben()
 {
     if (sp.ifDamage())
     {
         sc.LoadEnd();
         Destroy(this.gameObject);
     }
 }
Beispiel #2
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();
        }
    }
Beispiel #3
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();
        }
    }