Ejemplo n.º 1
0
    private IEnumerator generateGameCubes()
    {
        int y = (boardHeight / 2) - 120;
        int z = 275;

        for (int i = 0; i < height; i++)
        {
            int x = -1 * (width * 40 / 2) + 20;
            for (int j = 0; j < width; j++)
            {
                gameCubes[j, i] = (GameObject)Instantiate(gameCube, gameBoardClone.transform, false);
                gameCubes[j, i].transform.position = new Vector3(x, y, z);
                gameCubes[j, i].name = (i + 1) + ":" + (j + 1);
                gameCubes[j, i].GetComponent <gameCubeCatchController>().setGameController(gameObject.GetComponent <gameController>());
                x += 40;
            }
            y -= 40;
            yield return(null);
        }
        if (mmc.getIsLoading())
        {
            mmc.offLoadingCanvas();
        }
        isRestarting = false;
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (!mmc.getIsLoading())
        {
            float mouseX = Input.GetAxis("Mouse X");
            float mouseY = -Input.GetAxis("Mouse Y");
            rotY += mouseX * mouseSensitivity * Time.deltaTime;
            rotX += mouseY * mouseSensitivity * Time.deltaTime;

            rotX = Mathf.Clamp(rotX, -clampAngle, clampAngle);

            Quaternion localRotation = Quaternion.Euler(rotX, rotY, 0.0f);
            transform.rotation = localRotation;
        }
    }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (!mmc.getIsLoading() && !gc.getIsPaused())
     {
         if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
         {
             speed = 5;
         }
         else
         {
             speed = 2;
         }
         if (Input.GetKey(KeyCode.W))
         {
             transform.Translate(Vector3.forward * speed);
         }
         if (Input.GetKey(KeyCode.A))
         {
             transform.Translate(Vector3.left * speed);
         }
         if (Input.GetKey(KeyCode.S))
         {
             transform.Translate(Vector3.back * speed);
         }
         if (Input.GetKey(KeyCode.D))
         {
             transform.Translate(Vector3.right * speed);
         }
         if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
         {
             transform.Translate(Vector3.down * speed);
         }
         if (Input.GetKey(KeyCode.Space))
         {
             transform.Translate(Vector3.up * speed);
         }
     }
 }