예제 #1
0
    //割り当てる(一括)
    public Dictionary <GameObject, int> GetMarker(List <Vector3> posList, GameObject target, string functionName, float z = 0f)
    {
        var gDic = new Dictionary <GameObject, int>();
        int j    = 0;

        for (int i = 0; i < posList.Count; i++)
        {
            UIButtonMessage g = null;
            for (; j < prefabPool.Count; j++)
            {
                if (!prefabPool[j].gameObject.activeInHierarchy)
                {
                    g = prefabPool[j];
                    break;
                }
            }
            if (g)
            {
                g.gameObject.SetActive(true);
                g.transform.localScale = Vector3.one;
                var pos = FuncBox.ViewPointTransform(worldCamera, posList[i], uiCamera);
                pos.z = z;
                g.transform.position = pos;
                g.target             = target;
                g.functionName       = functionName;

                gDic.Add(g.gameObject, i);
            }
        }

        return(gDic);
    }
예제 #2
0
 /// <summary>
 /// 機体マーカーの更新
 /// </summary>
 protected void UpdateShipMarker()
 {
     if (flagLongRange)
     {
         Vector3 pos = FuncBox.ViewPointTransform(playerCamera.camera, player.transform.position, uiCamera);
         shipMarker.transform.position    = pos;
         shipMarker.transform.eulerAngles = player.transform.eulerAngles;
         if (player.lockObject)
         {
             pos = FuncBox.ViewPointTransform(playerCamera.camera, player.lockObject.transform.position, uiCamera);
             lockObjectMarker.transform.position    = pos;
             lockObjectMarker.transform.eulerAngles = player.lockObject.transform.eulerAngles;
         }
     }
 }
예제 #3
0
    public UISprite background;         //テキストバックグラウンド
    #region 関数
    /// <summary>
    /// ポップアップのテキスト、位置を設定する
    /// </summary>
    public void SetPopup(Camera sourceCam, Vector3 worldPos, string text)
    {
        //ポップアップの位置
        Vector3 pos = FuncBox.ViewPointTransform(sourceCam, worldPos, targetCamera);

        popup.transform.position = pos;
        //テキスト
        label.text = text;
        //背景
        Vector2 size  = label.relativeSize;
        Vector2 scale = label.transform.localScale;

        size.x *= scale.x;
        size.y *= scale.y;
        background.transform.localScale = size;
    }
 /// <summary>
 /// 移動UI表示の更新
 /// </summary>
 public void UpdateMoveUI()
 {
     //座標
     targetPos = FuncBox.ViewPointTransform(mainCamera, player.transform.position, uiCamera);
     moveUIParent.transform.position = FuncBox.Vector3Lerp(moveUIParent.transform.position, targetPos, 0.5f);
 }