示例#1
0
 public void StartGame()
 {
     splashScreen.SetActive(false);
     startButton.SetActive(false);
     hatController.ToggleControl(true);
     StartCoroutine(Spawn());
 }
示例#2
0
 public void Starter()
 {
     startButton.SetActive(false);
     playing = true;
     BallBombInstanter.instanter.InstanterSwitch(true);
     hatController.ToggleControl(true);
     hatSplash.SetActive(false);
 }
示例#3
0
    // Starting spawn, game over events
    public IEnumerator Spawn(float timeSpawn)
    {
        yield return(new WaitForSeconds(4));

        hatController.ToggleControl(true);
        playing = true;

        while (timeLeft > 0 && scoreClass.score >= 0)
        {
            Vector3    spawnPosition = new Vector3(Random.Range(-maxWidth, maxWidth), transform.position.y, 0.0f);
            Quaternion spawnRotation = Quaternion.identity;

            // Spawn management
            WasItScull();
            Instantiate(bunnyRabbits[getRand], spawnPosition, spawnRotation);
            if (getRand > 0)
            {
                scull = true;
            }
            else
            {
                scull = false;
            }

            // Speedup
            if (scoreClass.score % 5 == 0 && scoreClass.score > 0 && scoreClass.score < 50)
            {
                addTime = addTime + 0.2f;
            }
            yield return(new WaitForSeconds(timeSpawn / addTime));
        }

        // Game over
        // Mb this will work that way
        StartCoroutine(GameOver());

        /*timeLeft = 0.0f;
         * yield return new WaitForSeconds(0.5f);
         * hatController.ToggleControl(false);
         * yield return new WaitForSeconds(0.5f);
         * gameOverText.SetActive(true);
         * // Score management
         * GetComponent<Leaderboard>().CheckScores(scoreClass.score);
         * yield return new WaitForSeconds(0.5f);
         * leaderBoard.SetActive(true);
         * GetComponent<Leaderboard>().DrawScores();
         * if (GetComponent<Leaderboard>().isScore)
         * {
         * playerInputField.SetActive(true);
         * submitButton.SetActive(true);
         * }
         * else
         * {
         * yield return new WaitForSeconds(0.5f);
         * restartButton.SetActive(true);
         * menuButton.SetActive(true);
         * }*/
    }
示例#4
0
 public void StartGame()
 {
     spashScreenImage.SetActive(false);
     startBtn.SetActive(false);
     StartCoroutine(Spawn());
     hatController.ToggleControl(true);
     playing = true;
 }
示例#5
0
    public void StartGame()
    {
        splashScreen.SetActive(false);
        startButton.SetActive(false);
        startOne.SetActive(true);


        StartCoroutine(Change());
        hatController.ToggleControl(true);
        //to start our function our game
        StartCoroutine(Spawn());
    }
    // Use this for initialization
    void Start()
    {
        if (cam == null)
        {
            cam = Camera.main;
        }

        playing = true;

        Vector3 upperCorner = new Vector3(Screen.width, Screen.height, 0.0f);
        Vector3 targetWidth = cam.ScreenToWorldPoint(upperCorner);
        float   ballWidth   = balls[0].GetComponent <Renderer>().bounds.extents.x; 

            maxWidth = targetWidth.x - ballWidth;

        UpdateText();
        btnPause.gameObject.SetActive(false);

        pausePanel.gameObject.SetActive(false);
        btnResume.gameObject.SetActive(false);
        btnMenu.gameObject.SetActive(false);
        btnRestart.gameObject.SetActive(false);

        Button pause = btnPause.GetComponent <Button>();

        pause.onClick.AddListener(PauseOnClick);

        Button resume = btnResume.GetComponent <Button>();

        resume.onClick.AddListener(ResumeOnClick);

        Button menu = btnMenu.GetComponent <Button> ();

        menu.onClick.AddListener(MenuOnClick);


        StartCoroutine(Spawn());
        hatController1.ToggleControl(true);
        hatController2.ToggleControl(true);
        btnPause.gameObject.SetActive(true);

        //pause study

        Time.timeScale = 1;
        pauseObjects   = GameObject.FindGameObjectsWithTag("ShowOnPause");
        hidePaused();
    }
示例#7
0
 // se crea la función para iniciar el juego desde la splash scene
 // se quiere desactivar la SplashScreen y el startButton
 // asi como iniciar la corrutina Spawn
 // se necesita tener referencias a esas variables (que son GameObjects) y que sean públicas -se hace arriba
 public void StartGame()
 {
     hatController.ToggleControl(true);
     playing = true;
 }