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

public class GameController : MonoBehaviour {
	public GameObject mainCameraNonStatic;
	public static GameObject mainCamera;
	public Transform templates;

	public static List<GameObject> largeSpaceShips = new List<GameObject>();

	void Awake () {
		initStaticVar();
		TemplateManager.init(templates);
	}

	void Update () {
		
	}

	private void initStaticVar() {
		mainCamera = mainCameraNonStatic;
	}

	public static GameObject instantiate(GameObject original, Vector2 position, float rotation = 0.0f, Vector2 velocity = new Vector2()) {
		GameObject clone = Instantiate(original, new Vector3(position.x, position.y), Quaternion.identity);
		clone.transform.Rotate(0, 0, rotation);
		if (velocity.magnitude > 0) {
			clone.GetComponent<Rigidbody2D>().velocity = velocity;
		}
		return clone;
	}
}
