示例#1
0
    public void CorrectAnswer()
    {
        Countdown.Instance.StopCountdown();
        UI_Manager.Instance.OpenMenu(GameData.QuestionAnsweredScreen);
        GameData.QuestionAnsweredImage.color = Color.green;
        GameData.QuestionAnsweredText.text   = GameData.ActiveLanguage.fishing_correct_answer.Replace("<br>", "\n");

        SoundDatabase.PlayWinSound();

        var randomFish          = GameData.FishDatabase.items[Random.Range(0, GameData.FishDatabase.items.Count)];
        var sameFishInInventory = Player.Inventory.Where(x => x.data.ID == randomFish.data.ID);

        if (sameFishInInventory.Count() > 0)
        {
            sameFishInInventory.ElementAt(0).data.amount++;
        }
        else
        {
            var fish = Instantiate(randomFish, Player.Instance.inventoryParent);
            fish.Activate();
            Player.Inventory.Add(fish);
        }
        int amount = Random.Range(1, Player.Rod.data.fishMultiplier);

        Notification.Instance.Display(string.Format(GameData.ActiveLanguage.fishing_caught_fish, amount, randomFish.name), randomFish.icon, 2f, Notification.NotificationType.GoodNews);
    }