~ruther/NosSmooth

ref: 88445a88c9bc2a40b763af5f3fb5b723e7b062b0 NosSmooth/Core/NosSmooth.Game/Data/Info/Position.cs -rw-r--r-- 892 bytes
88445a88 — Rutherther chore(game): update project 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//
//  Position.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;

namespace NosSmooth.Game.Data.Info;

/// <summary>
/// Represents nostale position on map.
/// </summary>
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1313", MessageId = "Parameter names should begin with lower-case letter", Justification = "Standard.")]
public record struct Position(long X, long Y)
{
    /// <summary>
    /// Get the squared distance to the given position.
    /// </summary>
    /// <param name="position">The position.</param>
    /// <returns>The distance squared.</returns>
    public long DistanceSquared(Position position)
    {
        return ((position.X - X) * (position.X - X)) + ((position.Y - Y) * (position.Y - Y));
    }
}
Do not follow this link