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

public class CommandController : ModuleController {
	void Update () {
		spaceShipColliderRigidbody2d.AddTorque(-Input.GetAxis("Horizontal"));

		Vector2 speedGain = new Vector2(Input.GetAxis("Vertical") * 0.1f, 0).Rotate(spaceShipCollider.transform.rotation.eulerAngles.z);
		if (speedGain.magnitude > Mathf.Epsilon) {
			spaceShipColliderRigidbody2d.velocity += speedGain;
			//spaceShip.transform.localRotation = Quaternion.AngleAxis(speedGain.ToAngle(), Vector3.forward);
		}

		GameController.mainCamera.transform.position = new Vector3(transform.position.x, transform.position.y, GameController.mainCamera.transform.position.z);

		if (Input.GetKeyDown("e")) {
			this.enabled = false;
			charController.enabled = true;
		}
	}
}
