using UnityEngine;
using System.Collections.Generic;

public class CenterController : MonoBehaviour {

	Dictionary<string,GameObject> dict = new Dictionary<string,GameObject >(16);

	void Awake() {
		tag = "CenterController";
	}

	public void Register(string reg_name,GameObject g ) {
		if ( dict.ContainsKey(reg_name) ) throw new UnityException("Register name already in use");
		dict.Add(reg_name,g);
	}

	public GameObject Get(string reg_name ) {
		GameObject g=null;
		dict.TryGetValue(reg_name, out g);
		if ( g == null ) throw new UnityException("No gameobject registed with name="+reg_name); 
		return g;
	}
}
