Beispiel #1
0
    public void spin()
    {
        if (PlayerPrefs.GetInt("spin") > 0)
        {
            musicManager.UISFX(3);
            PlayerPrefs.SetString("spinTime", DateTime.Now.ToString());
            PlayerPrefs.SetInt("spin", PlayerPrefs.GetInt("spin") - 1);
            triangl.transform.SetParent(wheelOfFortuneSelection.transform, true);
            StartCoroutine(wheelTurned());
            dailySpinTime();
            if (PlayerPrefs.GetInt("notifications") == 0)
            {
                var notificationParams = new NotificationParams
                {
                    Id             = Random.Range(0, int.MaxValue),
                    Delay          = TimeSpan.FromDays(1),
                    Title          = "Daily Spin :3",
                    Message        = "Your Daily Spin is Ready, Go Catch sheeps !",
                    Ticker         = "Ticker",
                    Sound          = true,
                    Vibrate        = true,
                    Light          = true,
                    SmallIcon      = NotificationIcon.Heart,
                    SmallIconColor = new Color(0, 0.5f, 0),
                    LargeIcon      = "app_icon"
                };

                NotificationManager.CancelAll();
                NotificationManager.SendCustom(notificationParams);
            }
        }
    }
Beispiel #2
0
    void Update()
    {
        if (tutorielFinished)
        {
            StartCoroutine(sheepSpawner());
            tutorielFinished = false;
        }
        if (Input.GetMouseButtonDown(0))
        {
            if (!catchedSomething && combo > 0)
            {
                combo = 0;
                StartCoroutine(flareMaker(0.45f));
                StartCoroutine(GameObject.Find("Help Manager").GetComponent <helpManager>().errorCall());
                if (PlayerPrefs.GetString("Vibration") == "True")
                {
                    Handheld.Vibrate();
                }
            }

            if (catchedSomething)
            {
                catchedSomething = false;
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (!pausePanel.gameObject.activeSelf)
            {
                musicManager.UISFX(1);
                PlayerPrefs.SetInt("sheepy", totalSheepsCaught);
                pausePanel.SetActive(true);
                pausePanel.transform.GetChild(4).GetComponent <Image>().sprite =
                    musicImages[PlayerPrefs.GetInt("music")];
                pausePanel.transform.GetChild(5).GetComponent <Image>().sprite =
                    sfxImages[PlayerPrefs.GetInt("SFX")];
                Time.timeScale = 0;
            }
            else
            {
                ContinueGame();
            }
        }
    }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     PlayerPrefs.SetInt("netStock", 1);
     PlayerPrefs.SetInt("hayStackStock", 1);
     PlayerPrefs.SetInt("loveStock", 1);
     PlayerPrefs.GetString("Vibration", "True");
     musicManager = GameObject.Find("Music Manager").GetComponent <music>();
     musicManager.ObjectsSound(1);
     musicManager.UISFX(1);
     StartCoroutine(objectOpened(mainPanel));
 }
Beispiel #4
0
 public void forward()
 {
     musicManager.UISFX(0);
     killEverything();
     index += 1;
     if (index > 11)
     {
         StartCoroutine(objectClosed(mainPanel));
     }
     else
     {
         if (PlayerPrefs.GetInt("level") == 0)
         {
             manager();
         }
         else
         {
             ending();
         }
     }
 }
Beispiel #5
0
    void shipClicked()
    {
        if (sheepyRequested[currentSheepShowed] == 0)
        {
            openProblemPanel("This Sheep Is Not Needed !");
        }
        else
        {
            if (PlayerPrefs.GetInt("sheep" + currentSheepShowed) >= sheepyRequested[currentSheepShowed])
            {
                deactivatingButtons();
                PlayerPrefs.SetInt("sheep" + currentSheepShowed,
                                   PlayerPrefs.GetInt("sheep" + currentSheepShowed) - sheepyRequested[currentSheepShowed]);
                PlayerPrefs.SetInt("sheepy", PlayerPrefs.GetInt("sheepy") - sheepyRequested[currentSheepShowed]);
                PlayerPrefs.SetInt("money", PlayerPrefs.GetInt("money") + (sheepyRequested[currentSheepShowed] * 100));
                PlayerPrefs.SetInt("mostMoney", PlayerPrefs.GetInt("mostMoney") + (sheepyRequested[currentSheepShowed] * 100));
                cashUpdate(PlayerPrefs.GetInt("money"));
                sheepNumberText.GetComponent <TextMeshProUGUI>().text = " x " + PlayerPrefs.GetInt("sheepy");
                sheepyRequested[currentSheepShowed] = 0;
                //this long thing will make sure the player will have updated hunting

                for (int i = 0; i < indexes.Length; i++)
                {
                    if (indexes[i] >= 0)
                    {
                        if (indexes[i] == currentSheepShowed)
                        {
                            amounts[i] = 0;
                            PlayerPrefs.SetInt("amount" + i, 0);
                        }
                    }
                }
                loadCurrentMission();
                //end of confusing code
                musicManager.UISFX(3);
                StartCoroutine(shipLeaving());
            }
            else
            {
                openProblemPanel("You Don't Have Enough Sheeps !");
            }
        }
    }
Beispiel #6
0
 public void moreInfo()
 {
     musicManager.UISFX(0);
     GameObject.Find("Music Manager").GetComponent <PlayServicesMyVersion>().unlockAchievement(GPGSIds.achievement_curious_player);
     SceneManager.LoadScene("Credit");
 }
Beispiel #7
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Escape) && !quitPanel.activeSelf)
        {
            musicManager.UISFX(1);
            StartCoroutine(objectOpened(quitPanel));
        }

        //updating timer
        if (PlayerPrefs.GetInt("hearts") < PlayerPrefs.GetInt("maxHearts"))
        {
            string minutes = Mathf.Floor(PlayerPrefs.GetFloat("heartTime") / 60).ToString("00");
            string seconds = (PlayerPrefs.GetFloat("heartTime") % 60).ToString("00");
            timeText.GetComponent <TextMeshProUGUI>().text =
                minutes + ":" + seconds;
        }

        if (!Input.GetMouseButton(0))
        {
            for (int i = 1; i <= menuCount; i++)
            {
                if (ScrollBar.value < ((i * portion) - (portion / 2)) && ScrollBar.value > ((i - 1) * portion))
                {
                    ScrollBar.value = Mathf.Lerp(ScrollBar.value, (i - 1) * portion, 3 * Time.deltaTime);
                }
                if (ScrollBar.value > ((i * portion) - (portion / 2)) && ScrollBar.value < (i * portion))
                {
                    ScrollBar.value = Mathf.Lerp(ScrollBar.value, (i) * portion, 3 * Time.deltaTime);
                }
            }
        }
        //sliding menu control
        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began && !isGoingDown && !isGoingUp)
        {
            //when player presses, save that click position
            oldPosition = Input.mousePosition;
        }
        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended && !isGoingDown && !isGoingUp)
        {
            //when player lets go, save that position
            newPosition = Input.mousePosition;
        }
        //if both positions aren't null
        if (oldPosition != new Vector2(0f, 0f) && newPosition != new Vector2(0f, 0f))
        {
            if (Vector2.Distance(oldPosition, newPosition) >= (edgeOfScreen.x * 0.2f) &&
                Mathf.Abs(newPosition.y - oldPosition.y) < (edgeOfScreen.y * 0.07f))
            {
                if (oldPosition.x > newPosition.x)
                {
                    switch ((int)sceneContent.transform.localPosition.x)
                    {
                    case 800:
                        playButtonClicked();
                        break;

                    case 0:
                        shopButtonClicked();
                        break;
                    }
                }
                else
                {
                    switch ((int)sceneContent.transform.localPosition.x)
                    {
                    case -800:
                        playButtonClicked();
                        break;

                    case 0:
                        settingsButtonClicked();
                        break;
                    }
                }
                oldPosition = new Vector2(0f, 0f);
                newPosition = new Vector2(0f, 0f);
            }
        }

        if (Input.touchCount == 0)
        {
            oldPosition = new Vector2(0f, 0f);
            newPosition = new Vector2(0f, 0f);
        }

        if (isGoingUp)
        {
            ScrollBar.value = Mathf.Lerp(ScrollBar.value, destination, 5 * Time.deltaTime);
            if (Mathf.Approximately(ScrollBar.value, destination) && isGoingUp)
            {
                isGoingUp = false;
            }
        }
        if (isGoingDown)
        {
            ScrollBar.value = Mathf.Lerp(ScrollBar.value, destination, 5 * Time.deltaTime);
            if (Mathf.Approximately(ScrollBar.value, destination) && isGoingDown)
            {
                isGoingDown = false;
            }
        }
    }