using System.Collections; using System.Collections.Generic; using UnityEngine; namespace GeNa.Core { /// /// Place a derrived instance of this class on a GeNa Spline /// object to override the cross section used to create Road Meshes. /// [ExecuteInEditMode] public abstract class RoadCrossSectionOverride : MonoBehaviour { private void OnEnable() { NotifySpline(); } private void OnDisable() { NotifySpline(); } private void NotifySpline() { GeNaSpline spline = GetComponent(); if (spline != null && spline.enabled && spline.gameObject.activeInHierarchy) { GeNaRoadExtension road = spline.GetExtension(); if (road != null && road.IsActive) { road.PreExecute(); road.Execute(); } } } /// /// Return a RoadCrossSection instance for overriding /// the cross section used by the GeNa Road Extension /// to generate the road meshe(s). /// Note that the number of points and normals must be even, and the same size. /// /// public abstract RoadCrossSection GetRoadCrossSection(); } }