示例#1
0
    public void DuringDrag(int x, int y)
    {
        MapTile tile = mapCreator.GetTile(x, y);

        if (tile == null)
        {
            return;
        }
        TacticsMove clickedChar = tile.currentCharacter;

        if (clickedChar != null && clickedChar == lastSelectedCharacter.value)
        {
            mapCreator.ClearMovement();
            lastTarget.value   = null;
            attackTarget.value = null;
            currentMode.value  = ActionMode.MOVE;
        }
        else if (tile.selectable)
        {
            mapCreator.ClearMovement();
            tile.target        = true;
            lastTarget.value   = tile;
            attackTarget.value = null;
            lastSelectedCharacter.value.ShowMove(tile);
            currentMode.value = ActionMode.MOVE;
        }
        else if (tile.attackable && clickedChar != null)
        {
            tile.target        = true;
            attackTarget.value = tile;
            currentMode.value  = ActionMode.ATTACK;
            mapCreator.ClearMovement();
            lastTarget.value        = lastSelectedCharacter.value.CalculateCorrectMoveTile(lastTarget.value, attackTarget.value);
            lastTarget.value.target = true;
            lastSelectedCharacter.value.ShowMove(lastTarget.value);
        }
        else if (tile.supportable && clickedChar != null)
        {
            tile.target        = true;
            attackTarget.value = tile;
            currentMode.value  = ActionMode.HEAL;
            mapCreator.ClearMovement();
            lastTarget.value        = lastSelectedCharacter.value.CalculateCorrectMoveTile(lastTarget.value, attackTarget.value);
            lastTarget.value.target = true;
            lastSelectedCharacter.value.ShowMove(lastTarget.value);
        }
        characterClicked.Invoke();
    }
示例#2
0
    public void ShowMove(MapTile endTile)
    {
        mapCreator.ClearMovement();
        endTile.target = true;
        path.Clear();
        MapTile cTile = endTile;

        while (cTile.parent != null)
        {
            path.Push(cTile);
            cTile.pathable = true;
            cTile          = cTile.parent;
        }
    }