Esempio n. 1
0
 public void CellSelected(CubeCell cubeCell)
 {
     CurrentSelected = cubeCell;
     //Debug.Log("单元格选中:" + cubeCell.Position.x + "," + cubeCell.Position.y);
     if (cubeCell.CurrentUnit != null)
     {
         return;
     }
     UnitSelection.Get().ClearSelection();
     UIManager.Get().PushPanel(PanelTypes.UnitGenerationPanel);
 }
Esempio n. 2
0
    void CreateCell(uint x, uint z, uint i) //创建单元格
    {
        Vector3 position;

        position.x = x * 10f;
        position.y = Ground.transform.localPosition.y;
        position.z = z * 10f;
        CubeCell Cell = CubeCells[i] = Instantiate <CubeCell>(CubePrefab);

        Cell.SetPosition(x, z);
        Cell.transform.SetParent(transform, false);
        Cell.transform.localPosition = position + Offset;
        Cell.name = "CubeCell (" + x.ToString() + "," + z.ToString() + ")";
    }
Esempio n. 3
0
 public UnitSelection()
 {
     MonoBase.Get().GetMono().AddUpdateListener(() => {
         if (Input.GetMouseButtonDown(1))
         {
             if (start == null)
             {
                 end = null; return;
             }
             ClearSelection();
             UIManager.Get().MsgOnScreen("已清除当前选择");
         }
     });
 }
Esempio n. 4
0
    //private void Update()
    //{
    //    //for(int i=0;i<RowCounter.Count;i++)
    //    //    Debug.Log(string.Format("第{0}行单位数:{1}", i,RowCounter[i]));
    //}
    void CreateCell(int x, int z, int i) //创建单元格
    {
        Vector3 position;

        position.x = x * Distance;
        position.y = Ground.transform.localPosition.y;
        position.z = z * Distance;
        CubeCell Cell = Instantiate <CubeCell>(CubePrefab);

        CubeCells.Add(Cell);
        Cell.SetPosition(x, z);
        Cell.transform.SetParent(transform, false);
        Cell.transform.localPosition = position + Offset;
        Cell.name = string.Format("CubeCell({0},{1})", x, z);
        Cell.gameObject.SetActive(false);
    }
Esempio n. 5
0
    public void Set(CubeCell cubeCell)
    {
        if (Waiting)
        {
            return;
        }
        if (start == null)
        {
            start = cubeCell;
            UIManager.Get().MsgOnScreen("已选中" + start.CurrentUnit.UnitName);
            return;
        }

        if (end == null)
        {
            end = cubeCell;
            end.GetComponent <MeshRenderer>().material.color = Color.blue;
            start.CurrentUnit.Attack(end.CurrentUnit);
            ClearSelection();
        }
    }
Esempio n. 6
0
    }                                                     //获取单元格位置

    public void SetPosition(CubeCell cubeCell)
    {
        _position = cubeCell;
    }                                                                       //设置单元格位置
Esempio n. 7
0
 public void ClearSelection()
 {
     start = null; end = null;
 }