Пример #1
0
    public void Interact(InteractionType type, Interactor actor)
    {
        Transform item    = actor.GetItem();
        Present   present = item.GetComponent <Present>();

        if (present == null || GameStateManager.State.currentMoney >= present.price)
        {
            if (present != null)
            {
                GameStateManager.Collector.moneyGiftedAway += present.price;
                ++GameStateManager.Collector.numberGiftsPurchased;
                GameStateManager.Collector.moneySpent += present.price;
                GameStateManager.State.currentMoney   -= present.price;
            }
            actor.RemoveItem(item);
            friend.GivePresent(item);
            Destroy(item.gameObject);

            if (GameStateManager.FriendQueue.Count > 0)
            {
                SetFriend(GameStateManager.FriendQueue[Random.Range(0,
                                                                    GameStateManager.FriendQueue.Count)]);
            }
            else
            {
                SetFriend(null);
            }
        }
    }