Beispiel #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        finishLineColider = GetComponent <BoxCollider2D>();
        if (finishLineColider.IsTouchingLayers(LayerMask.GetMask("Player")))
        {
            Transform playerBody = collision.GetComponent <Transform>();
            Player    player     = collision.gameObject.GetComponent(typeof(Player)) as Player;
            player.isFinished(true);
            player.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);



            StartCoroutine(DeacreaseSize(playerBody));
            StartCoroutine(LoadNextLevel());
        }


        if (didintDo)
        {
            GameSession gameSession = FindObjectOfType <GameSession>();
            gameSession.AddToScoreBoard();
            didintDo = false;
            return;
        }
        else
        {
            return;
        }
    }