34 lines
910 B
C#
34 lines
910 B
C#
|
using System;
|
||
|
using System.Text.RegularExpressions;
|
||
|
|
||
|
using MfGames.Gallium;
|
||
|
using MfGames.Nitride.Generators;
|
||
|
|
||
|
namespace MfGames.Nitride.Temporal.Schedules;
|
||
|
|
||
|
/// <summary>
|
||
|
/// A schedule that uses the `UPath` of the entity to determine an offset from
|
||
|
/// a starting point and calculates the information from there.
|
||
|
/// </summary>
|
||
|
[WithProperties]
|
||
|
public partial class NumericalPathSchedule
|
||
|
{
|
||
|
public NumericalPathSchedule()
|
||
|
{
|
||
|
this.PathRegex = new Regex(@"^.*(\d+)");
|
||
|
this.GetPath = (entity) => entity.Get<UPath>().ToString();
|
||
|
this.CaptureGroup = 1;
|
||
|
this.CaptureOffset = -1;
|
||
|
}
|
||
|
|
||
|
public Regex? PathRegex { get; set; }
|
||
|
|
||
|
public Func<Entity, string> GetPath { get; set; }
|
||
|
public DateTime? ScheduleStart { get; set; }
|
||
|
public SchedulePeriod SchedulePeriod { get; set; }
|
||
|
|
||
|
public int CaptureGroup { get; set; }
|
||
|
|
||
|
public int CaptureOffset { get; set; }
|
||
|
}
|