Exemple #1
0
 public void displayChangeDifficulty()
 {
     GUI.Box(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 200, 400, 400), "Choose your difficulty");
     if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 100, 200, 25), "Easy"))
     {
         gm.changeDifficulty("Easy");
         changeDifficulty = false;
         gs.setStarted(true);
         print(gs.getStart());
     }
     if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 50, 200, 25), "Medium"))
     {
         gm.changeDifficulty("Medium");
         changeDifficulty = false;
         gs.setStarted(true);
     }
     if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2, 200, 25), "Hard"))
     {
         gm.changeDifficulty("Hard");
         changeDifficulty = false;
         gs.setStarted(true);
     }
 }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
//		bumpCollision bc = (bumpCollision)camera.GetComponent (typeof(bumpCollision));
        int score = gm.getScore();

//		print (score);
        if ((score % 1200 == 0 || score % 1300 == 0 || score % 4300 == 0) && score != 0)
        {
            //if ((score % 200==0) && score != 0) {
            reverseMouse = true;
            gs.setWhacked(true);
        }
        else
        {
            reverseMouse = false;
            gs.setWhacked(false);
        }
        if ((score % 500 == 0 || score % 600 == 0 || score % 700 == 0) && score != 0)
        {
            //if ((score % 500 == 0) && score != 0) {
            reverseKeys = true;
            gs.setWhacked(true);
        }
        else
        {
            reverseKeys = false;
            gs.setWhacked(false);
        }
        if (reverseMouse)
        {
            varMouse = -1.0f;
            gs.setWhacked(true);
        }
        else
        {
            varMouse = 1.0f;
            gs.setWhacked(false);
        }
        if (reverseKeys)
        {
            varKeys = -1.0f;
            gs.setWhacked(true);
        }
        else
        {
            varKeys = 1.0f;
            gs.setWhacked(false);
        }

        CharacterController charController = GetComponent <CharacterController>();

        bool gameStart = gs.getStart();

        if (doPitch && gameStart)
        {
            rotationPitch += Input.GetAxis("Mouse Y") * -5.0f * varMouse;
            rotationPitch  = Mathf.Clamp(rotationPitch, -45.0f, 45.0f);
        }
        if (doYaw && gameStart)
        {
            rotationYaw += Input.GetAxis("Mouse X") * 5.0f * varMouse;
        }
        transform.localEulerAngles = new Vector3(rotationPitch, rotationYaw, 0);

        float   deltaX   = Input.GetAxis("Horizontal") * 20.0f * varKeys;
        float   deltaZ   = Input.GetAxis("Vertical") * 20.0f * varKeys;
        Vector3 movement = new Vector3(deltaX, 0, deltaZ);

        //movement.y = -9.81f;

        movement = transform.TransformDirection(movement * Time.deltaTime);
        if (gameStart)
        {
            charController.Move(movement);
        }
    }