// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System; using Newtonsoft.Json; using osu.Game.Rulesets.Objects.Types; using osuTK; namespace osu.Game.Rulesets.Objects { public class PathControlPoint : IEquatable { private Vector2 position; /// /// The position of this . /// [JsonProperty] public Vector2 Position { get => position; set { if (value == position) return; position = value; Changed?.Invoke(); } } private PathType? type; /// /// The type of path segment starting at this . /// If null, this will be a part of the previous path segment. /// [JsonProperty] public PathType? Type { get => type; set { if (value == type) return; type = value; Changed?.Invoke(); } } /// /// Invoked when any property of this is changed. /// public event Action Changed; /// /// Creates a new . /// public PathControlPoint() { } /// /// Creates a new with a provided position and type. /// /// The initial position. /// The initial type. public PathControlPoint(Vector2 position, PathType? type = null) : this() { Position = position; Type = type; } public bool Equals(PathControlPoint other) => Position == other?.Position && Type == other.Type; public override string ToString() => type == null ? $"Position={Position}" : $"Position={Position}, Type={type}"; } }