| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | namespace Trailblazer.Pathing; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Represents the base class for survey result data, providing common state and behavior for survey result implementati |
| | | 7 | | /// </summary> |
| | | 8 | | /// <remarks> |
| | | 9 | | /// This abstract class defines shared properties and methods used to manage the lifecycle and |
| | | 10 | | /// state of survey results, such as validity, usage tracking, and chart utilization. |
| | | 11 | | /// Derived classes should implement additional functionality specific to their survey result type. |
| | | 12 | | /// Thread safety is not guaranteed; callers should ensure appropriate synchronization if instances are accessed concurr |
| | | 13 | | /// </remarks> |
| | | 14 | | public abstract class SurveyResult : ISurveyResult |
| | | 15 | | { |
| | | 16 | | internal TrailblazerWorldContext? Context { get; set; } |
| | | 17 | | |
| | | 18 | | /// <inheritdoc/> |
| | | 19 | | public bool IsValid { get; protected set; } |
| | | 20 | | |
| | | 21 | | /// <inheritdoc/> |
| | | 22 | | public bool IsInUse { get; protected set; } |
| | | 23 | | |
| | | 24 | | /// <inheritdoc/> |
| | | 25 | | public string[] ChartsUtilized { get; protected set; } = Array.Empty<string>(); |
| | | 26 | | |
| | | 27 | | /// <inheritdoc/> |
| | | 28 | | public int LastUsedFrame { get; protected set; } |
| | | 29 | | |
| | | 30 | | /// <inheritdoc/> |
| | | 31 | | public int RequestHashKey { get; protected set; } |
| | | 32 | | |
| | | 33 | | /// <inheritdoc/> |
| | 0 | 34 | | public virtual bool HasPath => false; |
| | | 35 | | |
| | | 36 | | /// <inheritdoc/> |
| | 2270 | 37 | | public void Checkout() => IsInUse = true; |
| | | 38 | | |
| | | 39 | | /// <inheritdoc/> |
| | | 40 | | public void Release() |
| | | 41 | | { |
| | 2209 | 42 | | IsInUse = false; |
| | 2209 | 43 | | LastUsedFrame = Context?.FrameCount ?? -1; |
| | 2209 | 44 | | } |
| | | 45 | | |
| | | 46 | | /// <inheritdoc/> |
| | | 47 | | public virtual void Reset() |
| | | 48 | | { |
| | 264 | 49 | | IsValid = false; |
| | 264 | 50 | | IsInUse = false; |
| | 264 | 51 | | Context = null; |
| | 264 | 52 | | ChartsUtilized = Array.Empty<string>(); |
| | 264 | 53 | | LastUsedFrame = -1; |
| | 264 | 54 | | RequestHashKey = -1; |
| | 264 | 55 | | } |
| | | 56 | | } |