Exemple #1
0
        void setBallToCenter()
        {
            gameObject.SetActive(true);
            transform.position = new Vector3(0, 5, 0);
            rb.isKinematic     = true;
            rb.isKinematic     = false;
            RestartPositions rp = GameObject.Find("Stadium3").gameObject.GetComponent <RestartPositions> ();

            rp.restartPositions();
            scored = false;
        }
Exemple #2
0
        private void showNumber()
        {
            greyTransparency.enabled = true;
            getready.text            = "Get Ready!";

            countdown.text = coutDownInt.ToString();
            --coutDownInt;

            if (coutDownInt < 0)
            {
                countdown.text = "";
                getready.text  = "";
                PlayerPrefs.SetInt("onPlay", 1);
                greyTransparency.enabled = false;
                RestartPositions rp = GameObject.Find("Stadium3").gameObject.GetComponent <RestartPositions> ();
                rp.setStiffness(3.0f);
            }
        }
Exemple #3
0
        // Update is called once per frame
        void FixedUpdate()
        {
            if (PlayerPrefs.GetInt("startGame") == 1)
            {
                PlayerPrefs.SetInt("startGame", 0);
                gameTransition.getReady();
            }
            else
            {
                onPlay = PlayerPrefs.GetInt("onPlay") == 1;
                if (onPlay)
                {
                    if (transform.position [2] < -170 && !scored)
                    {
                        scoreGoal(1);
                    }
                    else if (transform.position [2] > 170 && !scored)
                    {
                        scoreGoal(2);
                    }

                    if (Input.GetKeyDown("r"))
                    {
                        setBallToCenter();
                        RestartPositions rp = GameObject.Find("Stadium3").gameObject.GetComponent <RestartPositions> ();
                        rp.setStiffness(3.0f);
                    }
                    if (Input.GetKeyDown(KeyCode.Plus))
                    {
                        totalTime += 20.0f;
                    }
                    if (Input.GetKeyDown("o"))
                    {
                        ++count_t1;
                    }
                    if (Input.GetKeyDown("p"))
                    {
                        ++count_t2;
                    }
                    updateText(false);
                }
            }
        }