Пример #1
0
    void Move()
    {
        if (!EventSystem.current.IsPointerOverGameObject() && Input.GetMouseButtonUp(0))
        {
            int index   = hexGrid.GetCellIndex(transform.position); //当前人物位置
            int pointed = HexMapEditor.GetPointedIndex();           //当前光标位置

            //检测是否在移动范围,是否有其他人,是否有充足能量
            if (hexGrid.CheckInRange(index, pointed, 10) && hexGrid.GetRoleID(pointed) == -1 && UseEnergy(1))
            {
                hexGrid.SetRoleID(index, -1);
                hexGrid.SetRoleID(pointed, id);
                AddEXP(1);
                transform.position = HexMapEditor.GetPointedVec();
            }
        }
    }