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

public class RotateSl : MonoBehaviour {
	
	public int wayRouter;
	public RouterCheck router;
	
	// Update is called once per frame
	void Update () {

		if (Input.GetKeyDown (KeyCode.Space)) {

			wayRouter++;

			if (wayRouter == 4)
				wayRouter = 0;

			switch(wayRouter){
			case 0:
				this.GetComponent<Transform> ().rotation = Quaternion.AngleAxis (90, new Vector3(0,0,1));
				//ToAngleAxis (out 90,out new Vector3 (0, 0, 1));
				break;
			case 1:
				this.GetComponent<Transform> ().rotation = Quaternion.AngleAxis (180, new Vector3(0,0,1));
				//	this.GetComponent<Transform> ().rotation.ToAngleAxis (out 180,out new Vector3 (0, 0, 1));
				break;
			case 2:
				this.GetComponent<Transform> ().rotation = Quaternion.AngleAxis (270, new Vector3(0,0,1));
				//	this.GetComponent<Transform> ().rotation.ToAngleAxis (out 270,out new Vector3 (0, 0, 1));
				break;
			case 3:
				this.GetComponent<Transform> ().rotation = Quaternion.AngleAxis (0, new Vector3(0,0,1));
				//	this.GetComponent<Transform> ().rotation.ToAngleAxis (out 0,out new Vector3 (0, 0, 1));
				break ;
			}

			router.UpdateCollider ();
		}


	}
}
