コード例 #1
0
ファイル: PlayerController.cs プロジェクト: ptrick/JewelThief
    /// <summary>
    /// Creates grey boxes at each point the player has clicked before, but
    /// the player pawn hasn't caught up to yet.
    /// </summary>
    /// <param name="tilemap">The map</param>
    /// <returns>The line segments to render</returns>
    IEnumerable <SegmentProperties> GenerateCheckpointLines(IMap tilemap)
    {
        var segments = new List <SegmentProperties>();

        foreach (var c in commandCheckpoints)
        {
            var worldSpace = GridSpaceConversion.GetWorldSpaceFromLogical(c, tilemap);
            var square     = LineElements.SquareSelectionSegments(worldSpace, Color.grey);
            segments.AddRange(square);
        }

        return(segments);
    }
コード例 #2
0
ファイル: PlayerController.cs プロジェクト: ptrick/JewelThief
    /// <summary>
    /// Creates a box around where the user has their mouse targeted.
    /// The appears might vary depending on the validity of that location
    /// </summary>
    /// <param name="tilemap">The map</param>
    /// <returns>The line segments to render</returns>
    IEnumerable <SegmentProperties> GenerateSelectionBoxLines(IMap tilemap)
    {
        if (lastMouseLocationOffGrid)
        {
            return(new List <SegmentProperties>());
        }

        List <SegmentProperties> segments = new List <SegmentProperties>();

        var selectedCellWorldSpace = GridSpaceConversion.GetWorldSpaceFromLogical(lastMouseLocation, tilemap);

        Color boxColor = Color.white;

        if (!pendingTargetActive)
        {
            boxColor = Color.red;
            segments.AddRange(LineElements.XSegments(selectedCellWorldSpace, boxColor));
        }

        segments.AddRange(LineElements.SquareSelectionSegments(selectedCellWorldSpace, boxColor));

        return(segments);
    }