Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     if (activePos == 0)
     {
         if (Input.GetKeyDown(KeyCode.D))
         {
             camPositions[0].rotation = Quaternion.Euler(new Vector3(5, camPositions[0].rotation.eulerAngles.y + 60, 0));
             turnDir += 1;
             if (turnDir > 6)
             {
                 turnDir = 1;
             }
         }
         else if (Input.GetKeyDown(KeyCode.A))
         {
             camPositions[0].rotation = Quaternion.Euler(new Vector3(5, camPositions[0].rotation.eulerAngles.y - 60, 0));
             turnDir -= 1;
             if (turnDir < 1)
             {
                 turnDir = 6;
             }
         }
         if (Input.GetKeyDown(KeyCode.Space))
         {
             activePos = turnDir;
             if (activePos == 5)
             {
                 levelManager.Activate();
             }
             if (activePos == 1)
             {
                 StartCoroutine(MainMenu());
             }
         }
     }
     else if (Input.GetKeyDown(KeyCode.LeftShift) && activePos != 1)
     {
         if (activePos == 5)
         {
             levelManager.Deactivate();
         }
         activePos = 0;
         gameSaver.Save();
     }
     transform.position = Vector3.Lerp(transform.position, camPositions[activePos].position, smoothing * Time.deltaTime);
     transform.rotation = Quaternion.Slerp(transform.rotation, camPositions[activePos].rotation, smoothing * Time.deltaTime);
 }