コード例 #1
0
ファイル: CursorController.cs プロジェクト: eiseneker/tictacs
    public static void ShowActionCursors(Unit unit, int actionIndex)
    {
        showingActionCursors = true;
        UnitAction action = unit.Actions()[actionIndex].GetComponent <UnitAction>();

        ActionInformation.Show(action.Name(), action.MpCost().ToString(), action.actionType().ToString() + " -- " + action.Description());

        Unit.Coordinate projectedCoordinate = unit.ProjectedCoordinate();

        int xPos = projectedCoordinate.xPos;
        int zPos = projectedCoordinate.zPos;

        List <Cursor> tiles = Helpers.GetRadialTiles(xPos, zPos, action.MaxDistance(), action.MaxHeightDifference(), action.CanTargetOthers(), action.MinDistance(), action.HeightAssisted());

        foreach (Cursor tile in tiles)
        {
            if (IsValidTarget(Unit.Subject(), action, tile, xPos, zPos))
            {
                tile.SetAttack();
            }
        }
    }
コード例 #2
0
ファイル: CursorController.cs プロジェクト: eiseneker/tictacs
    public static void ShowActionRangeCursors(Cursor cursor, int actionIndex)
    {
        Unit unit = Unit.Subject();

        Unit.Coordinate projectedCoordinate = unit.ProjectedCoordinate();

        int unitxPos = projectedCoordinate.xPos;
        int unitzPos = projectedCoordinate.zPos;

        UnitAction    action = unit.Actions()[actionIndex].GetComponent <UnitAction>();
        List <Cursor> tiles  = new List <Cursor>();

        int xPos = cursor.xPos;
        int zPos = cursor.zPos;

        {
            if (action.CursorMode() == UnitAction.CursorModes.Radial)
            {
                if (action.RadialDistance() > 0)
                {
                    tiles = Helpers.GetRadialTiles(xPos, zPos, action.RadialDistance(), 1, true);
                }
            }
            else
            {
                tiles = Helpers.GetLineTiles(unitxPos, unitzPos, xPos, zPos, action.LineDistance());
            }
        }

        foreach (Cursor tile in tiles)
        {
            if (IsValidTarget(Unit.Subject(), action, tile, xPos, zPos))
            {
                tile.SetAttackInRange();
            }
        }
    }