Ejemplo n.º 1
0
    void AddToNotification(Friend who)
    {
        Friend copy = new Friend(who.name, 0, 0, 0, Color.clear, Color.clear, who.shirt, Color.clear, Vector3.zero);

        if (!who.friend)
        {
            copy.CancelFriendship();
        }

        notifNames.Add(copy);

        if (notifNames.Count == 1)
        {
            StartCoroutine(Notification());
        }
    }
Ejemplo n.º 2
0
    IEnumerator IncreaseTime()
    {
        time++;
        clockImg.color            = hour < 19 && hour > 7 ? new Color32(255, 227, 51, 255) : new Color32(0, 17, 163, 255);
        sun.transform.eulerAngles = hour < 19 && hour > 7 ? timeDay : timeNight;
        bool newDay = (time % 24 == 1);

        float dice = Random.value;

        if (newDay)
        {
            dayTh = Random.Range(0, majors.Length);
        }

        dice        = Random.value;
        float where = (local == 0) ? .8f : .7f;
        int    store = local;
        Friend busPartner;

        if (dice > where)
        {
            local = Random.Range(0, w.location.Length);

            //
            if (store != 1 && local == 1)
            {
                GenerateBusStrangers();

                //
                for (int i = 0; i < busSeat.Length; i++)
                {
                    busSeat[i] = Random.Range(0, 2);
                    busPass[i].transform.position = busStartPos[i] + (Vector3.down * busSeat[i] * 100);
                    SetAppearance(busPass[i], busPeople[i].skin, busPeople[i].hair, busPeople[i].shirt, busPeople[i].pants, busPeople[i].hairStyle);
                }

                busPartner = (busSeat[spot] == 0) ? busPeople[spot] : null;

                if (busPartner != null)
                {
                    float dice2 = Random.value;

                    if (dice2 > friProb)
                    {
                        AddAsFriend(busPartner);
                    }
                }

                f = busPartner;
            }
            else if (store != 2 && local == 2)
            {
                GenerateParkStrangers();

                //
                for (int i = 0; i < parkSeat.Length; i++)
                {
                    parkSeat[i] = Random.Range(0, 2);
                    parkFolk[i].transform.position = parkStartPos[i] + (Vector3.down * parkSeat[i] * 100);
                    SetAppearance(parkFolk[i], parkPeople[i].skin, parkPeople[i].hair, parkPeople[i].shirt, parkPeople[i].pants, parkPeople[i].hairStyle);
                }
            }
            else if (store != 3 && local == 3)
            {
                ChooseFriend();
            }
        }

        if (local != 1)
        {
            spot = Random.Range(0, w.location[local].spot.Length);
        }

        if (local == 0)
        {
            f1 = null;
            f2 = null;

            if (spot == 5)
            {
                ChooseFriend();

                v.transform.position    = new Vector3(-14.05f, 0, -3.06f);
                v.transform.eulerAngles = Vector3.up * 270;

                if (f != friends[0])
                {
                    if (dice > .98f)
                    {
                        quickEasyLocation += day + "," + f.name + "," + LocalConvert(local) + "," + f.relationship + ",REM\n";
                        f.CancelFriendship();
                        AddToNotification(f);
                        friends.Remove(f);
                    }
                }
            }
            else
            {
                v.transform.position = Vector3.down * 10000;
            }
        }
        else if (local == 2)
        {
            if (spot == 0)
            {
                f  = (parkSeat[0] == 0) ? parkPeople[0] : null;
                f1 = (parkSeat[1] == 1) ? parkPeople[1] : null;
                f2 = (parkSeat[2] == 2) ? parkPeople[2] : null;

                float[] dices = new float[3];

                for (int i = 0; i < dices.Length; i++)
                {
                    dices[i] = Random.value;

                    if (dices[i] > friProb)
                    {
                        AddAsFriend(parkPeople[i]);
                    }
                }
            }
            else if (spot == 2)
            {
                f = (parkSeat[parkSeat.Length - 1] == 0) ? parkPeople[parkPeople.Length - 1] : null;

                float dice2 = Random.value;

                if (dice2 > friProb)
                {
                    AddAsFriend(parkPeople[parkPeople.Length - 1]);
                }
            }
            else
            {
                f  = null;
                f1 = null;
                f2 = null;
            }
        }
        else if (local == 3)
        {
            f1 = null;
            f2 = null;


            if (spot == 0)
            {
                v.transform.position    = new Vector3(195.17f, 1.34f, -205.18f);
                v.transform.eulerAngles = Vector3.up * 180;
            }
            else if (spot == 1)
            {
                v.transform.position    = new Vector3(191.01f, 0.85f, -192.45f);
                v.transform.eulerAngles = Vector3.up * 0;
            }
            else
            {
                v.transform.position = Vector3.down * 10000;
            }
        }
        else
        {
            f1 = null;
            f2 = null;
        }

        addInterest();
        clockTick.eulerAngles = new Vector3(0, 180, hour * 360 / 12);
        dayTxt.text           = "Day:" + day;
        friendsTxt.text       = "Friends:" + numbFriends;

        p.transform.position           = w.location[local].spot[spot].pos;
        p.transform.eulerAngles        = w.location[local].spot[spot].rot;
        Camera.main.transform.position = w.ReturnCanPos(local);
        Camera.main.orthographicSize   = w.ReturnCamSize(local);

        tData.text = "Major Interests (" + secPerHour + ")SPH"
                     + "\nSeed: " + w.seed + " - " + w.momOff
                     + "\n-----"
                     + "\nCpu Science: " + cpuSci
                     + "\nBiology: " + bio
                     + "\nAstrophysics: " + astrophys
                     + "\nVis Arts: " + visArts
                     + "\nMarketing: " + marketing
        ;

        w.fM.Add(friends);

        //
        if (fullData)
        {
            WriteData(true, string.Format("{0},{1},{2},{3},{4},{5},\n", day, (float)cpuSci / 1000, (float)bio / 1000, (float)astrophys / 1000, (float)visArts / 1000, (float)marketing / 1000));
        }
        else if (!fullData & newDay)
        {
            WriteData(false, string.Format("{0},{1},{2},{3},{4},{5},\n", day, (float)cpuSci / 1000, (float)bio / 1000, (float)astrophys / 1000, (float)visArts / 1000, (float)marketing / 1000));
        }
        //
        if (day < year)
        {
            yield return(new WaitForSeconds(secPerHour));

            StartCoroutine(IncreaseTime());
        }
        else
        {
            print("Clarissa declared " + mNames[ReturnHighest(majors)] + " as her major! This was probably due to all the time that she spent with ");
            StreamWriter sW = new StreamWriter(Path.Combine(Application.dataPath, Generate.AddTimeStamp("DayNameLocal") + ".csv"));
            sW.Write(quickEasyLocation);
            sW.Close();

            //
            if (reRun)
            {
                Application.LoadLevel(Application.loadedLevel);
            }
        }
    }