void OnTriggerExit2D(Collider2D other)
 {
     if (other.GetComponent <LadderMiniGameButton>())
     {
         heldButton = null;
     }
 }
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <LadderMiniGameButton>())
        {
            if (heldButton != null)
            {
                Debug.LogError("Zwolnij itemy albo zmniejsz czestotliwosc.");
            }

            heldButton = other.GetComponent <LadderMiniGameButton>();
        }
    }
Exemplo n.º 3
0
    internal void OnUserActionButtonPressed()
    {
        LadderMiniGameTarget target = transform.Find("UI").Find("Target").GetComponent <LadderMiniGameTarget>();
        LadderMiniGameButton button = target.GetHeldButton();

        if (button != null)
        {
            Destroy(button.gameObject);
            target.VisualizeGood();
            leftPointsToWin--;
            if (leftPointsToWin <= 0)
            {
                FinishGameSuccess();
            }
        }
        else
        {
            FinishGameFail();
            hero.transform.position = transform.Find("LosePosition").position;
        }
    }