Esempio n. 1
0
    public void backFriends()
    {
        FriendList.bed1       = false;
        FriendList.bed2       = false;
        FriendList.floor1     = false;
        FriendList.floor2     = false;
        FriendList.desk       = false;
        FriendList.laundry    = false;
        FriendList.VisitorNum = 0;

        if (VisitFriend.penguin != null)
        {
            VisitFriend.penguin.GetComponent <Image> ().enabled     = false;
            VisitFriend.penguin.GetComponent <VisitFriend> ().myPos = "";
            VisitFriend.penguin.GetComponent <VisitFriend> ().TalkBalloonImage.SetActive(false);
            VisitFriend.penguin.GetComponent <VisitFriend> ().TalkBalloonImage2.SetActive(false);
            PlayerPrefs.SetString("PenguinVisitmyPos", "");
        }
        if (VisitFriend.sheep != null)
        {
            VisitFriend.sheep.GetComponent <Image> ().enabled     = false;
            VisitFriend.sheep.GetComponent <VisitFriend> ().myPos = "";
            VisitFriend.sheep.GetComponent <VisitFriend> ().TalkBalloonImage.SetActive(false);
            VisitFriend.sheep.GetComponent <VisitFriend> ().TalkBalloonImage2.SetActive(false);
            PlayerPrefs.SetString("SheepVisitmyPos", "");
        }
        if (VisitFriend.bear != null)
        {
            VisitFriend.bear.GetComponent <Image> ().enabled     = false;
            VisitFriend.bear.GetComponent <VisitFriend> ().myPos = "";
            VisitFriend.bear.GetComponent <VisitFriend> ().TalkBalloonImage.SetActive(false);
            VisitFriend.bear.GetComponent <VisitFriend> ().TalkBalloonImage2.SetActive(false);
            PlayerPrefs.SetString("bearVisitmyPos", "");
        }
        if (VisitFriend.snake != null)
        {
            VisitFriend.snake.GetComponent <Image> ().enabled     = false;
            VisitFriend.snake.GetComponent <VisitFriend> ().myPos = "";
            VisitFriend.snake.GetComponent <VisitFriend> ().TalkBalloonImage.SetActive(false);
            VisitFriend.snake.GetComponent <VisitFriend> ().TalkBalloonImage2.SetActive(false);
            PlayerPrefs.SetString("snakeVisitmyPos", "");
        }
        if (VisitFriend.owl != null)
        {
            VisitFriend.owl.GetComponent <Image> ().enabled     = false;
            VisitFriend.owl.GetComponent <VisitFriend> ().myPos = "";
            VisitFriend.owl.GetComponent <VisitFriend> ().TalkBalloonImage.SetActive(false);
            VisitFriend.owl.GetComponent <VisitFriend> ().TalkBalloonImage2.SetActive(false);
            PlayerPrefs.SetString("owlVisitmyPos", "");
        }
        if (VisitFriend.ammonite != null)
        {
            VisitFriend.ammonite.GetComponent <Image> ().enabled     = false;
            VisitFriend.ammonite.GetComponent <VisitFriend> ().myPos = "";
            VisitFriend.ammonite.GetComponent <VisitFriend> ().TalkBalloonImage.SetActive(false);
            VisitFriend.ammonite.GetComponent <VisitFriend> ().TalkBalloonImage2.SetActive(false);
            PlayerPrefs.SetString("ammoniteVisitmyPos", "");
        }
        if (VisitFriend.crocodile != null)
        {
            VisitFriend.crocodile.GetComponent <Image> ().enabled     = false;
            VisitFriend.crocodile.GetComponent <VisitFriend> ().myPos = "";
            VisitFriend.crocodile.GetComponent <VisitFriend> ().TalkBalloonImage.SetActive(false);
            VisitFriend.crocodile.GetComponent <VisitFriend> ().TalkBalloonImage2.SetActive(false);
            crocoBed.SetActive(false);
            crocoDesk.SetActive(false);
            crocoHaegndaz.GetComponent <Image>().enabled = false;
            if (!bed1.GetComponent <Image> ().enabled)
            {
                playerbed.SetActive(true);
            }
            PlayerPrefs.SetString("crocodileVisitmyPos", "");
        }
        if (VisitFriend.lion != null)
        {
            VisitFriend.lion.GetComponent <Image> ().enabled     = false;
            VisitFriend.lion.GetComponent <VisitFriend> ().myPos = "";
            VisitFriend.lion.GetComponent <VisitFriend> ().TalkBalloonImage.SetActive(false);
            VisitFriend.lion.GetComponent <VisitFriend> ().TalkBalloonImage2.SetActive(false);
            PlayerPrefs.SetString("lionVisitmyPos", "");
            LaundryItem.GetComponent <Item> ().load();
            if (LaundryItem.GetComponent <Item> ().BoughtNumber > 0)
            {
                LaundryImage.SetActive(true);
                LaundryFold.SetActive(false);
            }
        }

        if (PlayerPrefs.HasKey("PlayerPos"))
        {
            myPos = PlayerPrefs.GetString("PlayerPos");
        }

        switch (myPos)
        {
        case ("bed1"):
            FriendList.bed1 = true;
            break;

        case ("bed2"):
            FriendList.bed2 = true;
            break;

        case ("floor1"):
            FriendList.floor1 = true;
            break;

        case ("floor2"):
            FriendList.floor2 = true;
            break;

        case ("desk"):
            FriendList.desk = true;
            break;
        }

        PlayerPrefs.SetString("bed1", FriendList.bed1.ToString());
        PlayerPrefs.SetString("bed2", FriendList.bed2.ToString());
        PlayerPrefs.SetString("floor1", FriendList.floor1.ToString());
        PlayerPrefs.SetString("floor2", FriendList.floor2.ToString());
        PlayerPrefs.SetString("desk", FriendList.desk.ToString());
        PlayerPrefs.SetString("laundry", FriendList.laundry.ToString());

        // after party, laundry setactive
        LaundryItem.GetComponent <Item> ().load();
        if (LaundryItem.GetComponent <Item> ().BoughtNumber > 0)
        {
            LaundryImage.SetActive(true);
            LaundryFold.SetActive(false);
        }
    }
Esempio n. 2
0
    void back()
    {
        if (UnityEngine.Random.Range(1, 100) <= BackProbability)
        {
            switch (myPos)
            {
            case ("bed1"):
                if (crocobed.activeSelf)
                {
                    crocobed.SetActive(false);
                    player.RoomBed.SetActive(true);
                }
                FriendList.bed1 = false;
                disableImage();
                break;

            case ("floor1"):
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    cushion.GetComponent <Image>().enabled = false;
                }
                FriendList.floor1 = false;
                disableImage();
                break;

            case ("floor2"):
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    cushion.GetComponent <Image>().enabled = false;
                }
                FriendList.floor2 = false;
                disableImage();
                break;

            case ("desk"):
                if (crocodesk.activeSelf)
                {
                    crocodesk.SetActive(false);
                }
                if (crocohagen.GetComponent <Image> ().enabled)
                {
                    crocohagen.GetComponent <Image> ().enabled = false;
                }
                FriendList.desk = false;
                disableImage();
                break;

            case ("laundry"):
                if (ShopLaundry.GetComponent <Item>().BoughtNumber > 0)
                {
                    Laundry.SetActive(true);
                    LaundryFold.SetActive(false);
                }
                FriendList.laundry = false;
                disableImage();
                break;

            case (""):
                //bug!!
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    cushion.GetComponent <Image> ().enabled = false;
                }
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                {
                    crocodesk.SetActive(false);
                    crocohagen.GetComponent <Image> ().enabled = false;
                }
                disableImage();
                break;
            }
        }

        save();
    }
Esempio n. 3
0
    void Start()
    {
        AmmoOpened = (PlayerPrefs.GetString("AmmoOpened") == "True");
        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit" && !AmmoOpened)
        {
            AmmoOpened = true;
            PlayerPrefs.SetString("AmmoOpened", "True");

            int month = PlayerPrefs.GetInt("Month");
            int day   = PlayerPrefs.GetInt("Day");
            PlayerPrefs.SetInt("AmmoMonth", month);
            PlayerPrefs.SetInt("AmmoDay", day);
        }

        load();

        if (!isShown)
        {
            Invoke("visit", 3.0f);
        }

        if (!FriendList.Sleeping)
        {
            //default: 0,0,7
            Delta       = new TimeSpan(0, 0, 20);               // friends visit,back per 20 second
            Delta2      = new TimeSpan(0, 0, 20);               // save during 1 minute.
            SysTime     = System.DateTime.Now;
            UpdatedTime = SysTime;

            switch (myPos)
            {
            case ("bed1"):
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                {
                    ThisObject.transform.position = posCrocoBed;
                    crocobed.SetActive(true);
                    player.RoomBed.SetActive(false);
                }
                else
                {
                    //FriendImage.sprite = SeatImage [posNumber].sprite;
                    sprite();
                    ThisObject.transform.position = posBed1;
                }
                break;

            case ("floor1"):
                //FriendImage.sprite = SeatImage [posNumber].sprite;
                sprite();
                ThisObject.transform.position = posFloor1;
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    ThisObject.transform.position          = posAmmoFloor1;
                    cushion.GetComponent <Image>().enabled = true;
                }
                break;

            case ("floor2"):
                //FriendImage.sprite = SeatImage [posNumber].sprite;
                sprite();
                ThisObject.transform.position = posFloor2;
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                {
                    ThisObject.transform.position          = posAmmoFloor2;
                    cushion.GetComponent <Image>().enabled = true;
                }
                break;

            case ("desk"):
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                {
                    ThisObject.transform.position = posCrocoDesk;
                    if (PlayerPrefs.GetInt("hagendazBoughtNumber") == 0)
                    {
                        crocodesk.SetActive(true);
                    }
                    else
                    {
                        crocohagen.GetComponent <Image> ().enabled = true;
                    }
                }
                else
                {
                    //FriendImage.sprite = SeatImage [posNumber].sprite;
                    sprite();
                    ThisObject.transform.position = posDesk;
                }
                break;

            case ("laundry"):
                Laundry.SetActive(false);
                if (ShopLaundry.GetComponent <Item>().BoughtNumber > 0)
                {
                    LaundryFold.SetActive(true);
                }
                //FriendImage.sprite = SeatImage [posNumber].sprite;
                sprite();
                ThisObject.transform.position = posLaundry;
                break;
            }

            if (TimeCheck.TimeOver(Delta2))
            {
                if (FriendImage.GetComponent <Image> ().enabled == false && ItemCheck())
                {
                    visit();
                }
                else if (FriendImage.GetComponent <Image> ().enabled)
                {
                    back();
                }
            }
        }

        if (PlayerPrefs.HasKey(FriendNameVisit))
        {
            VisitCounter.text = PlayerPrefs.GetString(FriendNameVisit);
            VisitNumber       = IntParseFast(VisitCounter.text);
        }
    }
Esempio n. 4
0
    void visit()
    {
        if (snakeOK())
        {
            if (UnityEngine.Random.Range(1, 100) <= VisitProbability)
            {
                int i = UnityEngine.Random.Range(0, Seat.Length);
                if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "lionVisit" && IsPartyTime())
                {
                    i = 1;
                }
                else if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "lionVisit")
                {
                    i = 0;
                }

                switch (Seat[i])
                {
                case ("bed1"):
                    if (!FriendList.bed1)
                    {
                        // !bed2 option..
                        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                        {
                            ThisObject.transform.position = posCrocoBed;
                            FriendList.bed1 = true;
                            myPos           = "bed1";
                            posNumber       = i;
                            EnableImage();
                            crocobed.SetActive(true);
                            player.RoomBed.SetActive(false);
                            player.playerPos();
                            isShown = true;
                        }
                        else
                        {
                            ThisObject.transform.position = posBed1;
                            FriendList.bed1    = true;
                            myPos              = "bed1";
                            FriendImage.sprite = SeatImage [i].sprite;
                            posNumber          = i;
                            EnableImage();
                            player.playerPos();
                            isShown = true;
                        }
                    }
                    break;

                case ("floor1"):
                    if (!FriendList.floor1)
                    {
                        FriendList.floor1             = true;
                        ThisObject.transform.position = posFloor1;
                        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                        {
                            ThisObject.transform.position          = posAmmoFloor1;
                            cushion.GetComponent <Image>().enabled = true;
                        }
                        myPos = "floor1";
                        FriendImage.sprite = SeatImage [i].sprite;
                        posNumber          = i;
                        EnableImage();
                        player.playerPos();
                        isShown = true;
                    }
                    break;

                case ("floor2"):
                    if (!FriendList.floor2)
                    {
                        ThisObject.transform.position = posFloor2;
                        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "ammoniteVisit")
                        {
                            ThisObject.transform.position          = posAmmoFloor2;
                            cushion.GetComponent <Image>().enabled = true;
                        }
                        FriendList.floor2  = true;
                        myPos              = "floor2";
                        FriendImage.sprite = SeatImage [i].sprite;
                        posNumber          = i;
                        EnableImage();
                        player.playerPos();
                        isShown = true;
                    }
                    break;

                case ("desk"):
                    if (!FriendList.desk)
                    {
                        if (ThisObject.GetComponent <VisitFriend> ().FriendNameVisit == "crocodileVisit")
                        {
                            ThisObject.transform.position = posCrocoDesk;
                            FriendList.desk = true;
                            myPos           = "desk";
                            posNumber       = i;
                            EnableImage();
                            //crocodesk.SetActive (true);
                            if (hagendaz.GetComponent <Item> ().BoughtNumber == 0)
                            {
                                crocodesk.SetActive(true);
                            }
                            else
                            {
                                crocohagen.GetComponent <Image> ().enabled = true;
                            }
                            player.playerPos();
                            isShown = true;
                        }
                        else
                        {
                            ThisObject.transform.position = posDesk;
                            FriendList.desk    = true;
                            myPos              = "desk";
                            FriendImage.sprite = SeatImage [i].sprite;
                            posNumber          = i;
                            EnableImage();
                            player.playerPos();
                            isShown = true;
                        }
                    }
                    break;

                case ("laundry"):                                               // only lion!
                    if (!FriendList.laundry)
                    {
                        ThisObject.transform.position = posLaundry;
                        Laundry.SetActive(false);
                        if (ShopLaundry.GetComponent <Item>().BoughtNumber > 0)
                        {
                            LaundryFold.SetActive(true);
                        }
                        FriendList.laundry = true;
                        myPos = "laundry";
                        FriendImage.sprite = SeatImage [i].sprite;
                        posNumber          = i;
                        EnableImage();
                        player.playerPos();
                        isShown = true;
                    }
                    break;

                default:
//					Debug.Log ("NULL!");
                    break;
                }
            }
        }
        save();
    }