Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        /*
         * //Rotate the pen's right position with the rotation of the casette
         * Vector3 rot = this.transform.rotation * -pen.transform.right;
         * //Projects the rotated vector to a plane which normal is the pen up
         * Vector3 rotProj = Vector3.ProjectOnPlane(this.transform.rotation.eulerAngles, pen.transform.forward);
         * //Calculate the angle of the casette rotation projected to the plane perpendicular to the pen
         * float angle = Vector3.Angle(pen.transform.right, rotProj);
         * Debug.Log(rot + " " + rotProj + " " + angle + " " + fullRotationDegree);*/
        if (Input.GetMouseButton(1))
        {
            rotationTime += Time.deltaTime;
        }

        float angle = GetRotationAngle();

        fullRotationDegree += angle;
        lastAngle           = this.transform.rotation.eulerAngles.y;

        rotationCounter = startRotationCount + Mathf.FloorToInt(fullRotationDegree / 360);

        ChangeSliders();


        if (rotationCounter == 0 || rotationCounter == roundNeeded)
        {
            MenuPanelManager menuPanelManager = MenuPanelManager.GetInstance();
            menuPanelManager.SwitchMenuPanel(MenuPanelType.EndGameWinMenu);

            speedText.text = "You spin the casette " + GetRotationSpeed() + " degree/sec. You are awesome. ";
        }
    }
Exemplo n.º 2
0
    public void StartGame()
    {
        Time.timeScale = 1;

        MenuPanelManager menuPanelManager = MenuPanelManager.GetInstance();

        menuPanelManager.CloseMenu();
    }
Exemplo n.º 3
0
    public void RestartGame()
    {
        startGameButtonText.text = "Start Game";
        RotateCounter rc = FindObjectOfType <RotateCounter>();

        rc.ResetStartCondition();

        MenuPanelManager menuPanelManager = MenuPanelManager.GetInstance();

        menuPanelManager.CloseMenu();

        casette.ResetStartCondition();
        pen.ResetStartCondition();
    }
Exemplo n.º 4
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         MenuPanelManager menuPanelManager = MenuPanelManager.GetInstance();
         if (menuPanelManager.IsActivePanel(MenuPanelType.MainMenu))
         {
             Time.timeScale           = 1;
             startGameButtonText.text = "Start Game";
             menuPanelManager.CloseMenu();
         }
         else
         {
             Time.timeScale           = 0;
             startGameButtonText.text = "Resume Game";
             menuPanelManager.SwitchMenuPanel(MenuPanelType.MainMenu);
         }
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     menuButton = GetComponent <Button>();
     menuButton.onClick.AddListener(OnButtonClicked);
     menuPanelManager = MenuPanelManager.GetInstance();
 }
Exemplo n.º 6
0
    void DieAction()
    {
        MenuPanelManager menuPanelManager = MenuPanelManager.GetInstance();

        menuPanelManager.SwitchMenuPanel(MenuPanelType.EndGameLooseMenu);
    }