Rotor script (rotation into the - values)

so, i got this script and want to make a object rotate around the z axis till a certain point is reached. the script does that perfectly well, but now i want to make it able to rotate into the -degrees, how could i do that?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Rotor : MonoBehaviour {

public float MaxAngle;
public float MinAngle;
public float speed;
public KeyCode upKey;
public KeyCode downKey;
GameObject ObjectToRotate;

// Use this for initialization
void Start () {
    ObjectToRotate = transform.GetChild(0).gameObject;

// Update is called once per frame
void Update () {
    if (Input.GetKey(upKey) && MaxAngle > transform.GetChild(0).eulerAngles.z && MaxAngle > 0)


    if (Input.GetKey(downKey) && MinAngle < transform.GetChild(0).eulerAngles.z && MinAngle > 0)



According to the documentation (Unity - Scripting API: Transform.Rotate), the Vector3.forward parameter is not the axis but the euler angle.

public void Rotate(Vector3 eulerAngles, Space relativeTo = Space.Self);

I say it because I’m not sure this is what you want to do. If so, you can just invert the Euler angle : Rotate(-Vector3.forward)

You can also use the Transform.Rotate version that allows you to specify both the axis and the angle

public void Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);

With this version, you just have to set the axis as Vector3.forward, and put a positive or negative value for the angle.