Exemple #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.TryGetComponent(out Diver diver))
        {
            switch (TreasureNumber)
            {
            case 1:
                SaveManager.GetTreasureOne();
                TreasureGet();
                break;

            case 2:
                SaveManager.GetTreasureTwo();
                TreasureGet();
                break;

            case 3:
                SaveManager.GetTreasureThree();
                TreasureGet();
                break;

            case 4:
                StartCoroutine("EndGame");
                break;
            }
        }
    }