This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-nitride-cil/src/MfGames.Nitride.Temporal.Schedules/NumericalPathSchedule.cs

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; }
}