コード例 #1
0
    public void StartFriendSay(int choice)
    {
        minutesLeft     -= 2;
        minutesText.text = "Minutes Left: " + minutesLeft.ToString();

        string message = PlayerSheet.GetName(tmpID) + ": ";
        int    sendID;
        int    recID;

        switch (choice)
        {
        case 0:
            int toPrimary     = PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.T2P));
            int fromPrimary   = PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.TFP));
            int toSecondary   = PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.T2S));
            int fromSecondary = PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.TFS));

            bool noticeToPrimary     = (((toPrimary - toSecondary > 0)) && (toPrimary - fromSecondary > 0));
            bool noticeFromPrimary   = (((fromPrimary - toSecondary > 0)) && (fromPrimary - fromSecondary > 0));
            bool noticeToSecondary   = ((toSecondary - toPrimary > 0) && ((toSecondary - fromPrimary > 0)));
            bool noticeFromSecondary = ((fromSecondary - toPrimary > 0) && ((fromSecondary - fromPrimary > 0)));

            string[] typename = { "Preps", "Jocks", "Artists", "Nerds" };

            if (noticeToPrimary || noticeFromPrimary)
            {
                message += "I've noticed a lot of " + typename[PlayerSheet.GetTypeOne(tmpID) - 1] + " whispering amongst themselves.";
            }
            else if (noticeToPrimary || noticeFromPrimary)
            {
                message += "I've noticed a lot of " + typename[PlayerSheet.GetTypeTwo(tmpID) - 1] + " whispering amongst themselves.";
            }
            else if (PlayerSheet.GetTypeOne(tmpID) == PlayerSheet.GetTypeTwo(tmpID) && toPrimary > 3)
            {
                message += "I've noticed a lot of " + typename[PlayerSheet.GetTypeOne(tmpID) - 2] + " whispering amongst themselves.";
            }
            else
            {
                message += "I haven't noticed anything in particular.";
            }

            StartCoroutine(FriendSay(message, 0));
            break;

        case 1:
            sendID = PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.SFID1));
            recID  = PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.S2ID1));

            if (sendID != 0 && recID != 0)
            {
                message += "I noticed " + PlayerSheet.GetName(sendID) + " whispering to " + PlayerSheet.GetName(recID) + " very suspiciously.";
            }
            else
            {
                message += "Nah, I haven't seen anything strange. Why?";
            }

            int another = (PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.SFID2)) != 0) && (PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.S2ID2)) != 0) ? 1 : 0;
            StartCoroutine(FriendSay(message, another));
            break;

        case 2:
            message += PlayerSheet.GetRevealer(tmpID) + " told me.";
            StartCoroutine(FriendSay(message, 0));
            break;

        case 3:
            if (PlayerSheet.GetIndex(tmpID) == distributorID)
            {
                won      = true;
                message += "Aww you caught me. I'm so sorry, I just think it's so hilarious that you suck eggs! :(";
            }
            else
            {
                message += "How dare you accuse me! You're not a very good friend.";
            }
            StartCoroutine(FriendSay(message, 2));
            break;

        case 4:
            sendID   = PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.SFID2));
            recID    = PlayerSheet.GetSpreadStat(tmpID, Stat2Int(StatType.S2ID2));
            message += "I also noticed " + PlayerSheet.GetName(sendID) + " whispering to " + PlayerSheet.GetName(recID) + " very suspiciously.";
            break;
        }
    }
コード例 #2
0
    IEnumerator GameHandler()
    {
        int i = 0;

        while (true)
        {
            // Respawn NPC s
            PlayerSheet.Shuffle();
            SpawnChars();

            // Reset spread and minutes
            spread = 0;
            for (int j = 0; j < 80; j++)
            {
                if (PlayerSheet.GetParameter(j, (int)ParameterType.Infected) == true)
                {
                    spread++;
                }
            }
            spreadText.text  = "Spread: " + spread.ToString() + "/64";
            minutesLeft      = 16;
            minutesText.text = "Minutes Left: " + minutesLeft.ToString();

            // wait for end of turn
            while (!Input.GetKeyDown(KeyCode.N))
            {
                if (spread == 1)
                {
                    i    = 0;
                    days = 0;
                    break;
                }
                yield return(null);
            }

            //Reset for next turn
            DestroyChars();

            // stop if the whole school knows
            if (spread >= 64 || won)
            {
                break;
            }

            // Infector Spreads rumor

            // spread rumor
            for (int j = 0; j < 80; j++)
            {
                // if in position to spread
                int pair = PlayerSheet.CheckPair(j);
                if (pair >= 0 && (PlayerSheet.GetParameter(j, (int)ParameterType.Infected)) == true)
                {
                    int num_spread = PlayerSheet.GetSpreadToday(i);
                    int r          = Random.Range(1, 100);

                    // if rumor can be spread
                    bool isThinking = ((PlayerSheet.GetIndex(j) == 66 || PlayerSheet.GetIndex(j) == 67 || PlayerSheet.GetIndex(j) == 68 || PlayerSheet.GetIndex(j) == 70 || PlayerSheet.GetIndex(j) == 71 ||
                                        PlayerSheet.GetIndex(j) == 76 || PlayerSheet.GetIndex(j) == 78 || PlayerSheet.GetIndex(j) == 79 || PlayerSheet.GetIndex(j) == distributorID) || PlayerSheet.GetIndex(j) < 64);

                    if (((difficulty == 0 && num_spread == 0 && r <= 40) || (difficulty == 1) && r <= 80) && PlayerSheet.GetParameter(pair, (int)ParameterType.Infected) == false && isThinking)
                    {
                        // spread rumor
                        PlayerSheet.SetSpreadToday(j, num_spread + 1);
                        PlayerSheet.SetParameter(pair, (int)ParameterType.Infected, true);

                        if (PlayerSheet.GetIndex(pair) >= 64)
                        {
                            PlayerSheet.SetRevealer(pair, j);
                        }

                        // find room
                        int room = (int)Mathf.Floor(j / 16);
                        Debug.Log(PlayerSheet.GetName(j) + " spread to " + PlayerSheet.GetName(pair) + " in room " + room.ToString());

                        for (int k = 16 * room; k < 16 * (room + 1); k++)
                        {
                            bool sharespreader1_1  = (PlayerSheet.GetTypeOne(k) == PlayerSheet.GetTypeOne(j));
                            bool sharespreader1_2  = (PlayerSheet.GetTypeOne(k) == PlayerSheet.GetTypeTwo(j));
                            bool sharespreader2_1  = (PlayerSheet.GetTypeTwo(k) == PlayerSheet.GetTypeOne(j));
                            bool sharespreader2_2  = (PlayerSheet.GetTypeTwo(k) == PlayerSheet.GetTypeTwo(j));
                            bool sharesinfected1_1 = (PlayerSheet.GetTypeOne(k) == PlayerSheet.GetTypeOne(pair));
                            bool sharesinfected1_2 = (PlayerSheet.GetTypeOne(k) == PlayerSheet.GetTypeTwo(pair));
                            bool sharesinfected2_1 = (PlayerSheet.GetTypeTwo(k) == PlayerSheet.GetTypeOne(pair));
                            bool sharesinfected2_2 = (PlayerSheet.GetTypeTwo(k) == PlayerSheet.GetTypeTwo(pair));

                            // if it is a friend
                            if (PlayerSheet.GetIndex(k) > 64 && k != j && k != pair)
                            {
                                // if they share clique with spreader
                                if (sharespreader1_1 || sharespreader1_2 || sharespreader2_1 || sharespreader2_2)
                                {
                                    int observeChance = 20;
                                    int trendChance   = 20;
                                    int friend        = (PlayerSheet.GetIndex(k) - 64);

                                    // if intuitive
                                    if (friend == 0 || friend == 1 || friend == 3 || friend == 4 || friend == 5 || friend == 6 || friend == 7 || friend == 13)
                                    {
                                        trendChance = 40;
                                    }

                                    // if observant
                                    else
                                    {
                                        observeChance = 40;
                                    }

                                    int rObserve = Random.Range(1, 100);
                                    int rTrend   = Random.Range(1, 100);

                                    // if observed, enter into stats
                                    if (rObserve < observeChance)
                                    {
                                        int mod = (PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.HistInd) % 2) == 0) ? 0 : 2;
                                        PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.S2ID1) + mod, pair);
                                        PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.SFID1) + mod, j);

                                        Debug.Log(PlayerSheet.GetName(k) + " observed " + PlayerSheet.GetName(j) + " to: " + PlayerSheet.GetName(pair));
                                        Debug.Log(rObserve);
                                    }

                                    // if trend noticed
                                    if (rTrend < trendChance)
                                    {
                                        if (sharespreader1_1)
                                        {
                                            PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.T2P), PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.T2P)) + 1);
                                        }
                                        if (sharespreader1_2)
                                        {
                                            PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.T2P), PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.T2P)) + 1);
                                        }
                                        if (sharespreader2_1)
                                        {
                                            PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.T2S), PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.T2S)) + 1);
                                        }
                                        if (sharespreader2_2)
                                        {
                                            PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.T2S), PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.T2S)) + 1);
                                        }
                                        if (sharesinfected1_1)
                                        {
                                            PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.TFP), PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.TFP)) + 1);
                                        }
                                        if (sharesinfected1_2)
                                        {
                                            PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.TFP), PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.TFP)) + 1);
                                        }
                                        if (sharesinfected2_1)
                                        {
                                            PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.TFS), PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.TFS)) + 1);
                                        }
                                        if (sharesinfected2_2)
                                        {
                                            PlayerSheet.SetSpreadStat(k, Stat2Int(StatType.TFS), PlayerSheet.GetSpreadStat(k, Stat2Int(StatType.TFS)) + 1);
                                        }

                                        Debug.Log(PlayerSheet.GetName(k) + " noticed a Trend!");
                                        Debug.Log(rTrend);
                                    }
                                }
                            }

                            // add statistics
                            //PlayerSheet.SetSpreadToday(j, (int) SpreadType.ID1, pair);
                        }
                    }
                }
            }
            // new day
            if ((i % 3) == 0)
            {
                for (int j = 0; j < 80; j++)
                {
                    PlayerSheet.SetSpreadToday(j, 0);
                }
                days++;
                daysText.text = "Days: " + days.ToString();
            }
            i++;

            yield return(new WaitForEndOfFrame());
        }

        // Deconstruct game
        DestroyChars();
        miniMap.SetActive(false);
        HUD.SetActive(false);

        // start result manager
        StartCoroutine(EndGame());
    }