Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        fuelDisplay.value = fuel / maxFuel;
        if (fuel < 0f)
        {
            LoadScene.LoadLose();
        }
        bool didThrustVert = false;

        if (Input.GetKey(KeyCode.W))
        {
            fuel--;
            thrustForward();
            didThrustVert = true;
        }
        if (Input.GetKey(KeyCode.S))
        {
            fuel--;
            thrustBackward();
            didThrustVert = true;
        }
        if (!didThrustVert)
        {
            particle.setAcceleration(Vector2.zero);
        }
        if (Input.GetKey(KeyCode.D))
        {
            fuel--;
            thrustCW();
        }
        if (Input.GetKey(KeyCode.A))
        {
            fuel--;
            thrustCCW();
        }
        // constrain rotation to -pi pi
        if (shouldConstrainRot)
        {
            particle.constrainRotTo180ForDan();
        }
    }
 /* Called when the system dies, should do the game over stuff or call something in a game manager or something */
 void GoOffline()
 {
     LoadScene.LoadLose();
 }