Skip to main content

MiningEcho

A class in Root.Township, the global namespace.

Progression skill: a strong pickaxe hit sends out an echo pulse whose radius grows over time, shown to the player and passed to IListenToMiningEcho listeners (probably to reveal ore).

Constructors​

MemberWhat it is
MiningEcho()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

12 private and internal fields
MemberWhat it is
private PooledObjectDefinition echoDefinitionPooled effect spawned at the hit point for the local player.
private bool hasIntensityPlusWhether the player has the intensity upgrade skill; sent to clients with the effect.
private float hitMinEfficiencyMinimum hit effectiveness needed to trigger the echo.
private MiningEchoIntensity intensityPlusSkillThe MiningEchoIntensity skill that upgrades the effect.
private int levelZero-based skill level of the player who used it, used to pick the level definition.
private MiningEcho.LevelDefinition[] levelDefinitionsSize and duration curve for each skill level.
private static HashSet<IListenToMiningEcho> listenersStatic set of IListenToMiningEcho objects told about each running echo. Join with StartListening.
private static List<MiningEcho.MiningEchoExecution> miningEchoesStatic list of echoes currently expanding.
private ImpactChannel[] targetChannelsImpact channels the held tool must have for the skill to apply.
private LayerMask targetLayerLayers a tool hit must be on to trigger the echo.
private Dictionary<Pickup, ISkillInputMethod> toolInputsRegistered skill input for each held pickup.
private static IUnityUpdateMethod updateEchoesHandle for the static update method while echoes are running.

Methods​

MemberWhat it is
override void Deregister(ISkillInputMethod input)Forgets the input and stops listening for its tool's collisions.
override void ExecuteWithHit(HeldPickupHandler handler, ImpactHitWithTool hitWithTool, bool hasHit = true)Starts an echo at the hit point for the player's level, then runs the normal skill execution.
override void Register(ISkillInputMethod input)Remembers the input for its tool.
override void SetEffectActive(Pickup pickup, Player player, bool isEffectActive)Starts or stops listening for the tool's collisions.
static void StartListening(IListenToMiningEcho listener)Adds a listener that gets every running echo's centre and radius each frame.
static void StopListening(IListenToMiningEcho listener)Removes a listener.
override bool ValidateExecutionHit(ProgressionPath path, ImpactHitWithTool hitWithTool)Always false. The skill fires from tool collisions instead.
override bool ValidatePickup(HeldPickupHandler pickupHandler)True if the held tool has all the target channels.
protected override void EffectsRequested(NetworkEntity targetEntity, ToolBasedSkillStatus status, bool isLocalPlayer)For the local player, shows the echolocation effect at the hit for the used level.
protected override void SerializeInternal(Stream stream)When consumed, sends the level and whether the intensity upgrade skill is owned.
2 private and internal methods
MemberWhat it is
private void Collided(Collision collision, bool isHitting, ImpactTool tool)Handles the tool hitting something on targetLayer while the skill is active; if the hit is effective enough it resets the input and runs the echo.
private static void UpdateEchoes()Static update that grows each running echo, tells every listener its centre and radius, and stops when none are left.