Exemplo n.º 1
0
 private void DisableMiniGame()
 {
     stopCarPoliceControl.GoFadeDefaulCam();
     ParentAnimText.SetActive(false);
     this.gameObject.SetActive(false);
     ParentButtons.SetActive(false);
 }
Exemplo n.º 2
0
    private void Update()
    {
        if (IsStopped)
        {
            return;
        }

        if (direction == Direct.Left)
        {
            ImageCursor.rectTransform.anchoredPosition += Vector2.left * (Time.deltaTime * SpeedMove);
            if (ImageCursor.rectTransform.anchoredPosition.x <= LeftX_Red_Border)
            {
                direction = Direct.Right;
            }
        }
        if (direction == Direct.Right)
        {
            ImageCursor.rectTransform.anchoredPosition += Vector2.right * (Time.deltaTime * SpeedMove);
            if (ImageCursor.rectTransform.anchoredPosition.x >= RightX_Red_Border)
            {
                direction = Direct.Left;
            }
        }
        if (Input.GetMouseButtonDown(0))
        {
            ParentTut.SetActive(false);
            PlayerPrefs.SetInt(Constants.Tutors + "2", 1);

            if (ImageCursor.rectTransform.anchoredPosition.x > LeftX_Green_Border && ImageCursor.rectTransform.anchoredPosition.x < RightX_Green_Border)
            {
                IsStopped = true;
                if (Random.Range(0, 2) == 0)
                {
                    audioSource.clip = SoundWin;
                    audioSource.Play();
                    TextResultAlco.text = "YES";
                    IsAlco = true;
                }
                else
                {
                    audioSource.clip = SoundFail;
                    audioSource.Play();
                    TextResultAlco.text = "NO";
                    IsAlco = false;
                }
                ParentButtons.SetActive(true);
            }
        }
    }
Exemplo n.º 3
0
    private void OnEnable()
    {
        IsTapped = false;
        IsAlco   = false;
        ParentButtons.SetActive(false);
        TextResultAlco.text = "----";
        var rectTransform = ImageCursor.rectTransform;

        rectTransform.anchoredPosition = new Vector2(RightX_Red_Border, rectTransform.anchoredPosition.y);
        IsStopped = false;
        if (PlayerPrefs.GetInt(Constants.Tutors + "2") == 0)
        {
            ParentTut.SetActive(true);
        }
    }