Exemple #1
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.tag == Tags.LEFTBORDER)
        {
            _movement.TouchedRight = false;
            _movement.TouchedLeft  = true;
        }
        if (coll.tag == Tags.RIGHTBORDER)
        {
            _movement.TouchedLeft  = false;
            _movement.TouchedRight = true;
        }

        if (coll.tag == Tags.PICKUP)
        {
            IPickUp pickUp = coll.GetComponent <IPickUp>();
            pickUp.PickUp();
        }

        if (coll.tag == Tags.FLOOR)
        {
            PlayerDeath gameOver = coll.GetComponent <PlayerDeath>();
            gameOver.GameOver();
            Destroy(this.gameObject);
        }
    }