// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Types; using osuTK; namespace osu.Game.Rulesets.Objects { public class PathControlPoint : IEquatable { /// /// The position of this . /// [JsonProperty] public readonly Bindable Position = new Bindable(); /// /// The type of path segment starting at this . /// If null, this will be a part of the previous path segment. /// [JsonProperty] public readonly Bindable Type = new Bindable(); /// /// Invoked when any property of this is changed. /// internal event Action Changed; /// /// Creates a new . /// public PathControlPoint() { Position.ValueChanged += _ => Changed?.Invoke(); Type.ValueChanged += _ => Changed?.Invoke(); } /// /// Creates a new with a provided position and type. /// /// The initial position. /// The initial type. public PathControlPoint(Vector2 position, PathType? type = null) : this() { Position.Value = position; Type.Value = type; } public bool Equals(PathControlPoint other) => Position.Value == other?.Position.Value && Type.Value == other.Type.Value; } }