Ejemplo n.º 1
0
    protected override void OnTileNodeClick(GameObject go)
    {
        base.OnTileNodeClick(go);
        TileNode node = go.GetComponent <TileNode>();

        if (selectedUnit != null && node.IsVisible)         //可移动
        {
            prevNode = selectedUnit.node;
            if (selectedUnit.MoveTo(map, node, ref selectedUnit.currMoves))
            {
                allowInput = false;

                if (hideMarkersOnMove)
                {
                    prevNode.ShowNeighbours(((Unit)selectedUnit).maxMoves, false);                                    //移动并隐藏节点
                }
                if (hideSelectorOnMove)
                {
                    selectionMarker.Hide();                                    // 隐藏选择器
                }
                if (combatOn)
                {
                    attackRangeMarker.HideAll();                         //隐藏攻击范围
                }
                camMover.Follow(selectedUnit.transform);                 // 主摄像机跟随
            }
        }
    }
Ejemplo n.º 2
0
    // ====================================================================================================================
    #region input handlers - click tile

    protected override void OnTileNodeClick(GameObject go)
    {
        base.OnTileNodeClick(go);
        TileNode node = go.GetComponent <TileNode>();

        if (selectedUnit != null && node.IsVisible)
        {
            prevNode = selectedUnit.node;             // needed if unit is gonna move
            if (selectedUnit.MoveTo(node, ref selectedUnit.currMoves))
            {
                // dont want the player clicking around while a unit is moving
                allowInput = false;

                // hide the node markers when unit is moving. Note that the unit is allready linked with
                // the destination node by now. So use the cached node ref
                if (hideMarkersOnMove)
                {
                    prevNode.ShowNeighbours(((Unit)selectedUnit).maxMoves, false);
                }

                // hide the selector
                if (hideSelectorOnMove)
                {
                    selectionMarker.Hide();
                }

                // hide the attack range indicator
                if (combatOn)
                {
                    attackRangeMarker.HideAll();
                }

                // camera should follow the unit that is moving
                camMover.Follow(selectedUnit.transform);
            }
        }
    }