Esempio n. 1
0
    public GameObject ShowIcon(string name, Vector3 pos, UISpace mode)
    {
        GameObject icon = null;

        switch (mode)
        {
        case UISpace.WORLD:
            icon = Instantiate(Resources.Load("Prefabs/" + name), pos, Quaternion.identity) as GameObject;
            break;

        case UISpace.CANVAS:
            Vector2 canvasPos = GetCanvasPos(pos);
            icon = Instantiate(Resources.Load("Prefabs/" + name), transform) as GameObject;
            RectTransform rect = icon.transform as RectTransform;
            rect.anchoredPosition = canvasPos;
            break;

        case UISpace.CAMERA:
            icon = Instantiate(Resources.Load("Prefabs/" + name), canvas.transform) as GameObject;
            icon.transform.position = pos;
            break;

        case UISpace.OBJECT:
            icon = Instantiate(Resources.Load("Prefabs/" + name), null) as GameObject;
            icon.transform.position = pos;
            icon.AddComponent <LookAtCamera>();
            break;
        }

        return(icon);
    }
 /// <summary>
 /// Resets the UIToggleParmams back to defaults
 /// </summary>
 public virtual void Clear()
 {
     m_Name = string.Empty;
     m_ID = -1;
     m_RecieveActions = false;
     m_IsSelectable = false;
     m_UISpace = UISpace.TWO_DIMENSIONAL;
 }
 /// <summary>
 /// Copies the contents from one param to another
 /// </summary>
 /// <param name="aParams">The parameters to copy</param>
 public void Copy(UIToggleParams aParams)
 {
     m_Name = aParams.name;
     m_ID = aParams.id;
     m_RecieveActions = aParams.recieveActions;
     m_IsSelectable = aParams.isSelectable;
     m_UISpace = aParams.uiSpace;
     m_UIType = aParams.uiType;
 }