public TrailDrawer() { getNode = idx => new LineMeshGenerator.NodeData( relativePosition: nodes[idx].position - getTransformPosition(), distanceToPrevNode: nodes[idx].distanceToPrevNode ); lineMeshGenerator = F.lazy(() => new LineMeshGenerator( trailWidth, gameObject.GetComponent <MeshFilter>(), color, widthMultiplierCurve) ); }
public static A getOrElse <A>(this LazyVal <A> lazy, Fn <A> orElse) => lazy.isCompleted ? lazy.strict : orElse();
public static LazyVal <LST> upcast <MST, LST>(this LazyVal <MST> lazy) where MST : LST => project(lazy, mst => (LST)mst);
/// <summary> /// Create a new lazy value B, based on lazy value A. /// /// Evaluating B will evaluate A and evaluating A will evaluate B. /// /// Projector function is called on every access, so make sure it is something lite, /// like a cast or field access. /// </summary> public static LazyVal <B> project <A, B>(this LazyVal <A> lazy, Fn <A, B> projector) => new ProjectedLazyVal <A, B>(lazy, projector);
public static ConfigLookupError keyNotFound(LazyVal <string> message) => new ConfigLookupError(Kind.KEY_NOT_FOUND, message);
public static A getOrNull <A>(this LazyVal <A> lazy) where A : class => lazy.getOrElse((A)null);
/// <summary> /// Allows to use lazy value of more specific type where a lazy value of less specific type /// is required. /// /// You would think that this should work: /// <code><![CDATA[ /// worldSelect.map(_ => _.upcast<WorldSelectScreen.Init, IScreen>()) /// ]]></code> /// /// However, because <see cref="map{A,B}"/> creates a new lazy value, it does not propogate /// the initialization status. That means an underlying lazy value might be initialized, but /// a mapped value would not be. /// </summary> /// <typeparam name="MST">More specific type (like Cat)</typeparam> /// <typeparam name="LST">Less specific type (like Animal)</typeparam> public static LazyVal <LST> upcast <MST, LST>(this LazyVal <MST> lazy) where MST : LST => new UpcastLazyVal <MST, LST>(lazy);
public static ConfigLookupError wrongType(LazyVal <ImmutableArray <Tpl <string, string> > > extras) => new ConfigLookupError(Kind.WRONG_TYPE, extras);
public static LazyVal <LessSpecific> upcast <MoreSpecific, LessSpecific>( this LazyVal <MoreSpecific> lazy ) where MoreSpecific : LessSpecific => project(lazy, mst => (LessSpecific)mst);
/// <summary> /// Create a new lazy value B, based on lazy value A. /// /// Evaluating B will evaluate A, but evaluating A will not evaluate B. /// </summary> public static LazyVal <B> lazyMap <A, B>(this LazyVal <A> lazy, Func <A, B> mapper) => Lazy.a(() => mapper(lazy.strict));
public LazyRef(LazyVal <Ref <A> > backing) { this.backing = backing; }
[PublicAPI] public static LazyVal <Future <B> > lazyMapT <A, B>( this LazyVal <Future <A> > m, Fn <A, B> mapper ) => m.lazyMap(_ => _.map(mapper));
public static LazyVal <Option <B> > lazyFlatMapT <A, B>( this LazyVal <Option <A> > m, Fn <A, Option <B> > mapper ) => m.lazyMap(_ => _.flatMap(mapper));
public static ConfigLookupError wrongType(LazyVal <string> message) => new ConfigLookupError(Kind.WRONG_TYPE, message);
public ConfigLookupError(Kind kind, LazyVal <ImmutableArray <Tpl <string, string> > > lazyExtras) { this.kind = kind; this.lazyExtras = lazyExtras; }
public static LazyVal <LessSpecific> upcast <MoreSpecific, LessSpecific>( this LazyVal <MoreSpecific> lazy, LessSpecific example ) where MoreSpecific : LessSpecific => lazy.upcast <MoreSpecific, LessSpecific>();
public static ConfigLookupError keyNotFound(LazyVal <ImmutableArray <Tpl <string, string> > > extras) => new ConfigLookupError(Kind.KEY_NOT_FOUND, extras);
public static LazyVal <Try <B> > mapT <A, B>( this LazyVal <Try <A> > m, Fn <A, B> mapper ) => m.map(_ => _.map(mapper));
public UpcastLazyVal(LazyVal <MST> backing) { this.backing = backing; }
public static MarkovState <A> a <A>( A data, LazyVal <MarkovTransition <A>[]> transitions ) { return(new MarkovState <A>(data, transitions)); }
public static A getOrElse <A>(this LazyVal <A> lazy, A orElse) => lazy.isCompleted ? lazy.get : orElse;
public ProjectedLazyVal(LazyVal <A> backing, Fn <A, B> projector) { this.backing = backing; this.projector = projector; }
public static LazyVal <B> map <A, B>(this LazyVal <A> lazy, Fn <A, B> mapper) => F.lazy(() => mapper(lazy.get));
public ConfigLookupError(Kind kind, LazyVal <string> messageLazy) { this.kind = kind; this.messageLazy = messageLazy; }