BITFALL/Assets/WSM Game Studio/Train Controller_v3/Shared/Scripts/Route.cs

43 lines
1.3 KiB
C#
Raw Normal View History

2024-03-22 20:16:32 +08:00
using System.Collections.Generic;
using WSMGameStudio.Splines;
using UnityEngine;
namespace WSMGameStudio.RailroadSystem
{
[System.Serializable]
public class Route
{
[SerializeField] private string _name;
[SerializeField] private List<Spline> _splines;
[System.NonSerialized] private OrientedPoint[][] _normalizedRoute; //Calculate on loading time by the route manager
public string Name { get { return _name; } set { _name = value; } }
public List<Spline> Splines { get { return _splines; } set { _splines = value; } }
public OrientedPoint[][] NormalizedRoute { get { return _normalizedRoute; } set { _normalizedRoute = value; } }
/// <summary>
/// True if route has splines assigned to it
/// </summary>
public bool IsValid { get { return (_splines != null && _splines.Count > 0); } }
public int Length
{
get
{
int length = _splines == null ? 0 : _splines.Count;
return length;
}
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="name"></param>
public Route(string name)
{
_name = name;
_splines = new List<Spline>();
}
}
}