Beispiel #1
0
    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();
            }
        }
    }