Skip to main content

CaveTeleportConnection

A class in Root.Township, Alta.Caves.

A link between two cave teleporter layers and its fuel costs. Watches fuel on both layers and raises events as the link becomes usable or not.

Constructors​

MemberWhat it is
CaveTeleportConnection(CaveTeleporterProxyData fromLayer, CaveTeleporterProxyData toLayer, int fromCost, int toCost)Creates a CaveTeleportConnection from fromLayer, toLayer, fromCost, toCost, hasTo and hasFuelTo.
CaveTeleportConnection(CaveTeleporterProxyData fromLayer, int toLayer, int fromCost, int toCost)Creates a CaveTeleportConnection from fromLayer, toLayer, fromCost, toCost, hasTo and hasFuelTo.
2 private and internal constructors
MemberWhat it is
private CaveTeleportConnection()Creates a CaveTeleportConnection from fromLayer, toLayer, fromCost, toCost, hasTo and hasFuelTo.
private CaveTeleportConnection(CaveTeleporterProxyData fromLayer, int toLayer, int fromCost, int toCost, bool hasTo, bool hasFuelTo)Creates a CaveTeleportConnection from fromLayer, toLayer, fromCost, toCost, hasTo and hasFuelTo.

Fields​

MemberWhat it is
static CaveTeleportConnection NullConnectionA shared placeholder connection that's never valid.
3 private and internal fields
MemberWhat it is
private CaveTeleporterProxyData fromLayerDataTeleporter proxy data of the starting layer, checked for fuel.
private CaveTeleporterProxyData toLayerDataTeleporter proxy data of the target layer, set once it exists.
private bool wasValidLast IsValid value, so IsValidChanged only fires on change.

Properties​

MemberWhat it is
int FromCost { get; }Fuel the starting layer needs for the trip.
int FromLayer { get; }The layer the trip starts from.
bool HasFuelTo { get; private set; }Whether the destination layer has at least ToCost fuel.
bool HasTo { get; private set; }Whether the destination layer has a teleporter.
bool IsValid { get; }True when the destination exists and both layers have enough fuel.
int ToCost { get; }Fuel the destination layer needs for the trip.
int ToLayer { get; }The layer the trip goes to.

Events​

MemberWhat it is
event Action<bool> HasFuelToChangedRaised when HasFuelTo changes.
event Action<bool> HasToChangedRaised when a teleporter first shows up on the destination layer.
event Action<bool> IsValidChangedRaised when IsValid changes.

Methods​

MemberWhat it is
protected override void Finalize()Stops listening for fuel updates.
1 private and internal method
MemberWhat it is
private void UpdateValid(CaveTeleporterProxyData modifiedLayer)Handler for proxy fuel updates; refreshes HasTo, HasFuelTo and IsValid and fires their change events.

Used in​

Members of other types that take, return or hold a CaveTeleportConnection: