Beispiel #1
0
    // pause function
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.Escape))
        {
            if (Time.timeScale == 1)
            {
                Time.timeScale = 0;
            }
            else
            {
                Time.timeScale = 1;
            }
        }

        if (Input.GetKeyDown(KeyCode.Space) && puck.verticalOrientation())
        {
            float yDir = 0;
            if (puck.body.velocity.y > 0)
            {
                yDir = puck.originalSpeed / 2;
            }
            else
            {
                yDir = -puck.originalSpeed / 2;
            }
            puck.body.velocity = new Vector2(puck.originalSpeed, Random.Range(0, yDir));
        }
    }