예제 #1
0
    // Move to the neighborhood with the specified (x,y) coordinates
    void SetCurrentNeighborhood(Vector2 newPosition)
    {
        EventSystem.current.SetSelectedGameObject(null);

        // If there are "New!" tags on the arrows, remove them. They will need to be spawned again when the player navigates back
        // to the previous neighborhood.
        foreach (GameObject tag in GameObject.FindGameObjectsWithTag("ArrowTag"))
        {
            Destroy(tag);
        }
        Destroy(Up.GetComponent <NewTag>());
        Destroy(Down.GetComponent <NewTag>());
        Destroy(Left.GetComponent <NewTag>());
        Destroy(Right.GetComponent <NewTag>());

        // Set the neighborhood name, background, and the current position
        Neighborhood toSet = neighborhoodMap[newPosition];
        string       name  = toSet.getName();

        neighborhoodTitle.text      = name;
        background.sprite           = Resources.Load <Sprite>("Images/" + name);
        currentNeighborhoodPosition = newPosition;
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        Positive = true;
        StageSetUp.SetActive(true);
        Check1    = 0;
        Finish    = false;
        Lives     = PlayerPrefs.GetInt("PLives");
        Score     = PlayerPrefs.GetInt("PScore");
        Win       = PlayerPrefs.GetInt("Result");
        timecheck = -1;

        if (Win == 1)
        {
            Score++;
            PlayerPrefs.SetInt("PScore", Score);
        }
        else if (Win == 0)
        {
            Lives--;
            PlayerPrefs.SetInt("PLives", Lives);
        }

        if (Lives != 3 || Score != 0)
        {
            if (Win == 1)
            {
                Success.Play();
            }
            else
            {
                Fail.Play();
            }
        }

        if (Score == 20)
        {
            Finish = true;
        }
        if (Lives == 0)
        {
            NextGame = "LoseScreen";
            SceneManager.LoadScene(NextGame);
        }

        if (Score >= 15)
        {
            PlayerPrefs.SetInt("CurrentSets", 4);
            PlayerPrefs.SetFloat("PTime", 3.5f);
        }
        else if (Score >= 10)
        {
            PlayerPrefs.SetInt("CurrentSets", 3);
            PlayerPrefs.SetFloat("PTime", 4.5f);
        }
        else if (Score >= 5)
        {
            PlayerPrefs.SetInt("CurrentSets", 2);
            PlayerPrefs.SetFloat("PTime", 5.5f);
        }

        T = PlayerPrefs.GetFloat("PTime");

        if (Finish == true)
        {
            Up.GetComponent <SpriteRenderer>().enabled   = true;
            Down.GetComponent <SpriteRenderer>().enabled = false;
            CurtainGood.Play();
            Positive = true;
            NextGame = "VoteGame";
        }

        else if (Lives == 0)
        {
            Up.GetComponent <SpriteRenderer>().enabled   = false;
            Down.GetComponent <SpriteRenderer>().enabled = true;
            CurtainBad.Play();
            Positive = false;
            NextGame = "LoseScreen";
        }

        else
        {
            rvalue2 = RandomValue();
            PlayerPrefs.SetInt("CurrentGame", rvalue2);
            if (rvalue2 <= 7)
            {
                Up.GetComponent <SpriteRenderer>().enabled   = true;
                Down.GetComponent <SpriteRenderer>().enabled = false;
                CurtainGood.Play();
                Positive = true;
            }
            else
            {
                Up.GetComponent <SpriteRenderer>().enabled   = false;
                Down.GetComponent <SpriteRenderer>().enabled = true;
                CurtainBad.Play();
                Positive = false;
            }
            if (rvalue2 == 0)
            {
                NextGame = "GolfAnimatedGame";
                //  RuleText.text = "DUMP RESORT: TAP at the right moment";
            }
            else if (rvalue2 == 1)
            {
                NextGame = "TextGame1";
                //  RuleText.text = "COVFEFE: TAP the correct letters";
            }
            else if (rvalue2 == 2)
            {
                NextGame = "SodaGame";
                //   RuleText.text = "CHUG DIET SODA: CLICK and HOLD soda";
            }

            else if (rvalue2 == 3)
            {
                NextGame = "WallGame";
                //  RuleText.text = "BUILD THE WALL: TAP to place missing bricks";
            }
            else if (rvalue2 == 4)
            {
                NextGame = "GrabCatGame";
                //  RuleText.text = "GRAB THE PUSSY: TAP to grab the pussy";
            }

            else if (rvalue2 == 5)
            {
                NextGame = "SteakGame";
                //  RuleText.text = "SHAKE THE KETCHUP! CLICk and DRAG to prepare your meal";
            }
            else if (rvalue2 == 6)
            {
                NextGame = "ButinGame";
                //  RuleText.text = "PROTECT BUTIN: CLICK to hide Butin";
            }

            else if (rvalue2 == 7)
            {
                NextGame = "CombGame";
                //  RuleText.text = "READY THE NUKES: TAP the keys in time";
            }

            else if (rvalue2 == 8)
            {
                NextGame = "GrabWomanGame";
                //   RuleText.text = "GRAB THE PUSSY: TAP to grab the pussy";
            }
            else if (rvalue2 == 9)
            {
                NextGame = "EarthGame";
                //  RuleText.text = "CLICK THE USA to exit the Paris agreement";
            }
            else if (rvalue2 == 10)
            {
                NextGame = "PipeGame";
                //  RuleText.text = "Drag the pipes to the pipeline";
            }
            else if (rvalue2 == 11)
            {
                NextGame = "MoneyGame";
                //    RuleText.text = "P**N STAR HUSH MONEY: CLICK and DRAG only 130,000 dollars";
            }
            else if (rvalue2 == 12)
            {
                NextGame = "ImmigrantsGame";
                //   RuleText.text = "KEEP THOSE IMMIGRANTS OUT!: TAP on the immigrant";
            }

            else if (rvalue2 == 13)
            {
                NextGame = "AirportGame";
                //   RuleText.text = "KEEP THOSE MUSLIMS OUT!: TAP on the muslim";
            }

            else if (rvalue2 == 14)
            {
                NextGame = "KeyGame";
                //  RuleText.text = "READY THE NUKES: TAP the keys in time";
            }
        }
    }
예제 #3
0
    void Update()
    {
        if (alive)
        {
            timeLeft -= Time.deltaTime;
            if (timeLeft < 0)
            {
                if (Input.touchCount == 1)               // user is touching the screen with a single touch
                {
                    Touch touch = Input.GetTouch(0);     // get the touch
                    if (touch.phase == TouchPhase.Began) //check for the first touch
                    {
                        fp = touch.position;
                        lp = touch.position;
                    }
                    else if (touch.phase == TouchPhase.Moved) // update the last position based on where they moved
                    {
                        lp = touch.position;
                    }
                    else if (touch.phase == TouchPhase.Ended) //check if the finger is removed from the screen
                    {
                        lp = touch.position;                  //last touch position. Ommitted if you use list

                        //Check if drag distance is greater than 15% of the screen height
                        if (Mathf.Abs(lp.x - fp.x) > dragDistance || Mathf.Abs(lp.y - fp.y) > dragDistance)
                        {//It's a drag
                         //check if the drag is vertical or horizontal
                            if ((lp.x - fp.x) > 0 && (lp.y - fp.y) > 0)
                            {
                                if (transform.position.x < xR)//Right swipe
                                {
                                    this.transform.Translate(1 * movementScale, 0, 0);
                                }
                            }
                            if ((lp.x - fp.x) < 0 && (lp.y - fp.y) > 0)
                            {                                  //lewo
                                if (transform.position.y < yT) // Debug.Log("Up Swipe");
                                {
                                    this.transform.Translate(0, 1 * movementScale, 0);
                                }
                            }
                            if ((lp.x - fp.x) > 0 && (lp.y - fp.y) < 0)
                            {                                  //gora
                                if (transform.position.y > yB) // Debug.Log("Down Swipe");
                                {
                                    this.transform.Translate(0, -1 * movementScale, 0);
                                }
                            }
                            if ((lp.x - fp.x) < 0 && (lp.y - fp.y) < 0)
                            {                                  //dol
                                if (transform.position.x > xL) // Debug.Log("Left Swipe");
                                {
                                    this.transform.Translate(-1 * movementScale, 0, 0);
                                }
                            }
                        }
                        else
                        {   //It's a tap as the drag distance is less than 20% of the screen height
                            //Here we can make tap.postion as desiredPostion to move object rounded to the nearest block
                            //Debug.Log("Tap");
                        }
                    }
                }
            }
            foreach (GameObject red in CubeRed)
            {
                if (red.transform.position.x == transform.position.x && red.transform.position.y == transform.position.y)
                {
                    Bomb();
                    alive = false;
                }
            }
            if (transform.position.y == yT && transform.position.x == xR)
            {
                RightBottom.GetComponent <FinalGoindUp>().Colour();
                RightBottom.GetComponent <FinalGoindUp>().Metod();
                Up.GetComponent <MoveGoingUp>().Metod();
                Invoke("next", 2);
            }
        }
    }