/// <summary>
        /// Ctor
        /// </summary>
        public UISkit(GameObject obj, Sprite[] sprites)
            : base(obj, sprites)
        {
            this.type = UIType.Skit;
            this.npc = NpcModels.Instance.Get(obj.name);
            Emotion = npc.emotion;

            bubblePosition = gameObject.transform.position;
        }
        //NPC npc;
        // Use this for initialization
        void Start()
        {
            gameObject.name = id;
            npc = NpcModels.Instance.Get(id);
            Log.Assert(npc != null, "Missing NPC:"+id);

            //image = (UIImage)UIManager.Instance.Get(gameObject.GetInstanceID());
            Log.Assert(image != null, "NO uiImage found as: "+gameObject.name);

            bubble = CreateBubble(id);
        }
        /// <summary>
        /// Get one npc by subject
        /// </summary>
        public NPC Get(string id)
        {
            foreach(NPC n in npcs)
            {
                if(n.id == id)
                    return n;
            }

            //add new npc with id
            NPC npc = new NPC(id);
            npcs.Add(npc);
            return npc;

            //throw new System.Exception("No NPC exist with id:"+id);
        }
        /// <summary>
        /// Add a npc
        /// </summary>
        public NPC Add(NPC npc)
        {
            foreach(NPC n in npcs)
            {
                //avoid to add the same npc again
                if(npc.id == n.id)
                    return n;
            }
            npcs.Add(npc);

            return npc;
        }
        /// <summary>
        /// ctor for creating it from dictionary (from file)
        /// </summary>
        public UISkit(Dictionary<string,object> dict)
            : base(dict)
        {
            this.type = UIType.Skit;

            this.npc = NpcModels.Instance.Get(dict["id"].ToString());
            Emotion = npc.emotion;

            if (dict.ContainsKey("background"))
            {
                Dictionary<string,object> bg = (Dictionary<string,object>)dict["background"];
                if (bg.ContainsKey("sprite"))
                {
                    GameObject gameObject = new GameObject();
                    gameObject.name = "background";
                    gameObject.transform.parent = this.gameObject.transform;
                    SpriteRenderer renderer = gameObject.AddComponent<SpriteRenderer>();

                    background = (UIImage)UIManager.Instance.Add(UIType.Image, gameObject, bg["sprite"].ToString());
                    gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero);

                    if(bg.ContainsKey("position"))
                    {
                        string[] pos = bg["position"].ToString().Split(',');
                        float px = System.Convert.ToSingle(pos[0]);
                        float py = System.Convert.ToSingle(pos[1]);

                        gameObject.transform.localPosition = new Vector3(px, py, 0);
                    }

                    if (bg.ContainsKey("order"))
                    {
                        renderer.sortingOrder = System.Convert.ToInt32(bg["order"].ToString());
                    }
                }
            }

            bubblePosition = new Vector3(0, 0, 0);
            bubbleTail = "N";
            bubbleScale = new Vector3(25, 25, 25);
        }
        /// <summary>
        /// ctor for creating it from dictionary (from file)
        /// </summary>
        public UICharacter(Dictionary<string,object> dict)
            : base(dict)
        {
            this.type = UIType.Character;

            //Log.Info("UIChar ID:"+dict["id"].ToString());

            this.npc = NpcModels.Instance.Get(dict["id"].ToString());
            Emotion = npc.emotion;
            //bubblePosition = gameObject.transform.position;

            //Log.Info("NPC activated name:"+npc.name);
        }