Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("Game Begins");

        bananaRewardWindowManager.Hide();

        BuildGameProgressionLogicList();

        //Building card list including secret cards
        allCards = new List <Card>();
        allCards.AddRange(cards_2Entities);
        Array.ForEach(secretCards_2Entities, card =>
        {
            if (GameProgressionUtil.GetCardAvailability(card.cardEnum))
            {
                allCards.Add(card);
            }
        });

        showingGameOverMenu = false;
        cpuCoroutines.Clear();
        timer = GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.GoGo ? GameUtil.timer : 0f;

        player1 = (Player)Player.PLAYER_1.RebuildToPlay();
        player1.Stats.Restart();
        player1.finalScore = 0;
        player1.points     = 0;
        player1.penalties  = 0;
        if (GameSettingsUtil.GetGameType() == GameSettingsUtil.GameTypeEnum.Single)
        {
            player1.SetNewName(Player.SINGLE_PLAYER_NAME);
        }

        player2 = (Player)Player.PLAYER_2.RebuildToPlay();
        if (GameSettingsUtil.GetGameType() == GameSettingsUtil.GameTypeEnum.Two)
        {
            player2.Stats.Restart();
            player2.finalScore = 0;
            player2.points     = 0;
            player2.penalties  = 0;
        }
        GameUtil.cpuList.ForEach(cpu =>
        {
            cpu.Stats.Restart();
            cpu.finalScore = 0;
            cpu.points     = 0;
            cpu.penalties  = 0;
        });
        UpdateScoresAndNameText();
        gameOver    = false;
        cardInDelay = false;
        roundSeperator.SetActive(false);
        StartCoroutine(NewRoundWithDelay());
    }
Exemplo n.º 2
0
 private void UpdateGameMode()
 {
     if (GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.Coco)
     {
         int pointsToReach = GameSettingsUtil.GetCocoModePointsToReach();
         gameOption.value = pointsToReach;
     }
     else
     {
         float timer = GameSettingsUtil.GetGoGoModeTimer();
         gameOption.value = timer;
     }
     UpdateGameParams(gameOption.value.ToString());
 }
Exemplo n.º 3
0
 private void CheckForGameOver()
 {
     if (GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.Coco)
     {
         if (player1.finalScore >= GameUtil.pointsToReach ||
             (GameSettingsUtil.GetGameType() == GameSettingsUtil.GameTypeEnum.Two && player2.finalScore >= GameUtil.pointsToReach) ||
             GameUtil.cpuList.Any(cpu => cpu.finalScore >= GameUtil.pointsToReach))
         {
             gameOver = true;
         }
     }
     else if (GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.GoGo && timer <= 0)
     {
         gameOver = true;
     }
 }
Exemplo n.º 4
0
 void UpdateGameParams(string value)
 {
     if (GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.Coco)
     {
         instructions.text     = "Get " + value + " correct\nas fast as you can!";
         instructions.fontSize = 80;
         pointsToReach         = int.Parse(value);
         GameSettingsUtil.SetCocoModePointsToReach(pointsToReach);
     }
     else
     {
         instructions.text     = "Get as many as you can in\n" + value + " seconds!";
         instructions.fontSize = 85;
         timer = float.Parse(value);
         GameSettingsUtil.SetGoGoModeTimer(timer);
     }
 }
Exemplo n.º 5
0
    void Start()
    {
        allCpus = new List <Cpu>()
        {
            null, Cpu.KELSEY, Cpu.ANDREW, Cpu.MONKEY, Cpu.PENGUIN
        };
        allCpus.Add(Cpu.KONGO);
        allCpus.Add(Cpu.PURPLE_MONKEY);
        allCpus.Add(Cpu.MUFFIN);
        allCpus.Add(Cpu.CHOMP);
        allCpus.Add(Cpu.COCO);

        List <int> cpusInPlay = GameSettingsUtil.GetCpusInPlayList();

        SetCpu(0, cpusInPlay[0]);
        SetCpu(1, cpusInPlay[1]);
        SetCpu(2, cpusInPlay[2]);

        cpuPicker.Close(true, false);

        twoPlayersToggle.isOn       = GameSettingsUtil.GetGameType() == GameSettingsUtil.GameTypeEnum.Two;
        gogoGameModeToggle.isOn     = GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.GoGo;
        allowGameOptionChangedSound = false;
    }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (!cardInDelay && !gameOver)
        {
            if (GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.Coco)
            {
                timer += Time.deltaTime;
            }
            else if (GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.GoGo)
            {
                timer -= Time.deltaTime;
            }
        }

        timerText.text = TransformTime(timer);
        CheckForGameOver();
        if (!gameOver)
        {
            timerText.color = new Color32(255, 255, 255, 255);
        }
        else
        {
            timerText.color = new Color32(0, 255, 0, 255);
        }
        if (gameOver && !showingGameOverMenu)
        {
            if (cardGameObject != null)
            {
                DestroyImmediate(cardGameObject.gameObject);
                cardGameObject = null;
            }
            GameProgressionUtil.UpdateGameProgression(rep => rep.totalTimeSpentPlaying += GameSettingsUtil.GetGameMode() == GameSettingsUtil.GameModeEnum.GoGo ? GameUtil.timer : timer);
            if (GameSettingsUtil.GetGameType() == GameSettingsUtil.GameTypeEnum.Single)
            {
                GameProgressionUtil.UpdateGameProgression(rep => rep.totalSinglePlayerGamesPlayed++);
            }
            if (GameSettingsUtil.GetGameType() == GameSettingsUtil.GameTypeEnum.Two)
            {
                GameProgressionUtil.UpdateGameProgression(rep => rep.totalTwoPlayerGamesPlayed++);
            }
            if (GameUtil.cpuList.All(cpu => cpu.finalScore < player1.finalScore) || (GameSettingsUtil.GetGameType() == GameSettingsUtil.GameTypeEnum.Two && GameUtil.cpuList.All(cpu => cpu.finalScore < player2.finalScore)))
            {
                GameProgressionUtil.UpdateGameProgression(rep => rep.totalCpusDefeated += GameUtil.cpuList.Count);
            }
            if (GameUtil.cpuList.Contains(Cpu.ANDREW) && GameUtil.cpuList.Contains(Cpu.KELSEY))
            {
                GameProgressionUtil.UpdateGameProgression(rep => rep.totalGamesWithAndrewAndKelsey++);
            }
            if (GameUtil.cpuList.Contains(Cpu.COCO) && GameUtil.cpuList.Contains(Cpu.MUFFIN))
            {
                GameProgressionUtil.UpdateGameProgression(rep => rep.totalGamesWithCocoAndMuffin++);
            }
            if (GameUtil.cpuList.Contains(Cpu.MONKEY) && GameUtil.cpuList.Contains(Cpu.PENGUIN))
            {
                GameProgressionUtil.UpdateGameProgression(rep => rep.totalGamesWithMonkeyAndPenguin++);
            }
            GameProgressionUtil.UpdateGameProgression(rep => rep.totalCorrectGuessesStreak += correctStreak);

            showingGameOverMenu = true;
            ShowGameOverMenu();

            gameProgressionLogicContainerList.ForEach(l =>
            {
                RewardAndBarrier[] list = GameProgressionUtil.GetCorrectRewards(l.rewardAndBarriers, l.initialValue, GameProgressionUtil.GetGameProgressionField(l.lambda));
                AttemptRewardUnlock(list, l.reasonString);
            });

            bananaRewardWindowManager.BeginUnlockPhase();
        }
    }