예제 #1
0
 /// <summary>
 /// Checks your score and assesses your performance with a PopUp
 /// </summary>
 public void EndGame()
 {
     playing = false;
     guitargod.SetActive(false);
     playerMovement.Stop = false;
     if (score > 800)
     {
         StartCoroutine(iManager.PopUp("You are a guitar god!"));
         return;
     }
     else if (score > 700)
     {
         StartCoroutine(iManager.PopUp("You rock!"));
         return;
     }
     else if (score > 600)
     {
         StartCoroutine(iManager.PopUp("Well played."));
         return;
     }
     else if (score > 500)
     {
         StartCoroutine(iManager.PopUp("Decent performance."));
         return;
     }
     else if (score > 400)
     {
         StartCoroutine(iManager.PopUp("Well, it could have been worse."));
         return;
     }
     else if (score < 400)
     {
         StartCoroutine(iManager.PopUp("Are you drunk?"));
     }
 }
        /// <summary>
        /// Checks winning conditions. Randomizes damage, also if
        /// player is very drunk the player has a higher chance of missing.
        /// </summary>
        /// <param name="user">bfPlayer or bfNPC. The list contains the image of the player at [0] and hp bar at [1].</param>
        private void attackResult(List <Image> user)
        {
            int damage = random.Next(0, 3);

            if (user == bfPlayer)
            {
                if (player.drunkLevel > 60 && damage != 0)
                {
                    damage = random.Next(0, 3);
                }
                npcHP += damage;
                StartCoroutine(showInfo("Player deals " + damage + " damage!"));
                if (npcHP >= 5)
                {
                    events.ChangeTime(10);
                    events.addScore(20);
                    StartCoroutine(iManager.PopUp("You showed who's the boss."));
                    player.useMoney(random.Next(0, 30));
                    target.Remove();
                    target.StopInteracting();
                    barfight.SetActive(false);
                }
                else
                {
                    bfNPC[1].sprite = npcHPBar[npcHP];
                }
            }
            else if (user == bfNPC)
            {
                damage    = random.Next(0, 3);
                playerHP += damage;
                StartCoroutine(showInfo("NPC deals " + damage + " damage!"));
                if (playerHP >= 5)
                {
                    target.StopInteracting();
                    StartCoroutine(cutscene.CutsceneBlackout());
                    player.useMoney(-(random.Next(0, 20)));
                    barfight.SetActive(false);
                }
                else
                {
                    bfPlayer[1].sprite = playerHPBar[playerHP];
                }
            }
        }