Ejemplo n.º 1
0
    // Use this for initialization
    void Awake()
    {
        //audioCheck = PlayerPrefs.GetInt ("Audio");
        chosenShip = PlayerPrefs.GetInt("chosenShip");
        //chosenShip = 0;
        ship1    = GameObject.Find("ship1");
        ship2    = GameObject.Find("ship2");
        ship3    = GameObject.Find("ship3");
        ship1Cam = GameObject.Find("ship1Cam");
        ship2Cam = GameObject.Find("ship2Cam");
        ship3Cam = GameObject.Find("ship3Cam");

        if (chosenShip == 0)
        {
            ship1.SetActive(true);
            ship2.SetActive(false);
            ship3.SetActive(false);
            ship1Cam.SetActive(true);
            ship2Cam.SetActive(false);
            ship3Cam.SetActive(false);
            player        = ship1.GetComponent <AccelScript> ();
            touchFunction = ship1.GetComponent <Touch_Control> ();
        }
        else if (chosenShip == 1)
        {
            ship1.SetActive(false);
            ship2.SetActive(true);
            ship3.SetActive(false);
            ship1Cam.SetActive(false);
            ship2Cam.SetActive(true);
            ship3Cam.SetActive(false);
            player        = ship2.GetComponent <AccelScript> ();
            touchFunction = ship2.GetComponent <Touch_Control> ();
        }
        else if (chosenShip == 2)
        {
            ship1.SetActive(false);
            ship2.SetActive(false);
            ship3.SetActive(true);
            ship1Cam.SetActive(false);
            ship2Cam.SetActive(false);
            ship3Cam.SetActive(true);
            player        = ship3.GetComponent <AccelScript> ();
            touchFunction = ship3.GetComponent <Touch_Control> ();
        }
        isExiting           = false;
        state               = GameState.PLAYING;
        Settings.gamestate  = state;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Time.timeScale      = 0.0f;


        //score = score.GetComponent<ScoreV3> ();
        score.setDistance(0);
        score.stopScore();
        audioControl.mute = true;
        gameStarted       = false;
        if (pauseMenu.activeSelf)
        {
            pauseMenu.SetActive(false);
        }
        panel3 = panel_2.transform.FindChild("sensitivity_panel").gameObject;

        gameOver.SetActive(false);
        Settings.health = 10000;
        if (!accelBtn.isOn && !touchBtn.isOn)
        {
            accelBtn.isOn         = true;
            player.accelerometer  = true;
            touchFunction.touchOn = false;
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Awake()
    {
        //audioCheck = PlayerPrefs.GetInt ("Audio");
        chosenShip = PlayerPrefs.GetInt ("chosenShip");
        //chosenShip = 0;
        ship1 = GameObject.Find ("ship1");
        ship2 = GameObject.Find ("ship2");
        ship3 = GameObject.Find ("ship3");
        ship1Cam = GameObject.Find ("ship1Cam");
        ship2Cam = GameObject.Find ("ship2Cam");
        ship3Cam = GameObject.Find ("ship3Cam");

        if (chosenShip == 0) {
            ship1.SetActive (true);
            ship2.SetActive (false);
            ship3.SetActive (false);
            ship1Cam.SetActive (true);
            ship2Cam.SetActive (false);
            ship3Cam.SetActive (false);
            player = ship1.GetComponent<AccelScript> ();
            touchFunction = ship1.GetComponent<Touch_Control> ();
        } else if (chosenShip == 1) {
            ship1.SetActive (false);
            ship2.SetActive (true);
            ship3.SetActive (false);
            ship1Cam.SetActive (false);
            ship2Cam.SetActive (true);
            ship3Cam.SetActive (false);
            player = ship2.GetComponent<AccelScript> ();
            touchFunction = ship2.GetComponent<Touch_Control> ();
        } else if (chosenShip == 2) {
            ship1.SetActive (false);
            ship2.SetActive (false);
            ship3.SetActive (true);
            ship1Cam.SetActive (false);
            ship2Cam.SetActive (false);
            ship3Cam.SetActive (true);
            player = ship3.GetComponent<AccelScript> ();
            touchFunction = ship3.GetComponent<Touch_Control> ();
        }
        isExiting = false;
        state = GameState.PLAYING;
        Settings.gamestate = state;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Time.timeScale = 0.0f;

        //score = score.GetComponent<ScoreV3> ();
        score.setDistance (0);
        score.stopScore ();
        audioControl.mute = true;
        gameStarted = false;
        if (pauseMenu.activeSelf) {
            pauseMenu.SetActive (false);
        }
        panel3 = panel_2.transform.FindChild ("sensitivity_panel").gameObject;

        gameOver.SetActive (false);
        Settings.health = 10000;
        if (!accelBtn.isOn && !touchBtn.isOn) {
            accelBtn.isOn = true;
            player.accelerometer = true;
            touchFunction.touchOn = false;
        }
    }