Пример #1
0
    public void SetPlayerListeners()
    {
        // pick up collectable
        player.OnPickupCollectable += (Collectable collectable) => {
            collectables.Add(collectable);
            hud.AddCollectable(collectable);
            Destroy(collectable.gameObject);
        };

        // end moving
        player.OnMoveEnded += () => {
            moves += 1;
            hud.UpdateMoves(moves);

            if (maxItems > 0)
            {
                int itemCount = GetCollected(typeof(Item));
                if (itemCount == maxItems)
                {
                    StartCoroutine(GameWin());
                }
            }
        };
    }