Skip to main content

BoughtSkillOrbReplacer

A class in Root.Township, the global namespace.

The orb for a skill a player already owns on the progression board. Pulling it away and holding it for timeToBreak seconds sells the skill back. Synced by the server.

Constructors​

MemberWhat it is
BoughtSkillOrbReplacer()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private BoughtSkillVisualizer boughtSkillVisualizerThe skill visualizer this orb is anchored to. Used for the locked effect and to block grabs while it is in use.
private FixedJoint fixedJointJoint holding the orb to the visualizer's anchor body. Added on first anchor.
private AnimationCurve hapticOverDurationHaptic strength over the pull-out progress.
private bool hasVisualizerWhether an experience fill visualizer was given.
private float minDistanceToBreakSquared distance the hand must pull from the start point before progress counts.
private MethodSyncStruct<bool> syncDependencyLockMessage used to send IsLockedByDependencies to clients.
private float timeToBreakSeconds the orb must be held pulled out before it operates.
private ExperienceFillVisualizer visualizerFill visualizer showing the sell progress.

Properties​

MemberWhat it is
bool IsLockedByDependencies { get; private set; }True when the skill can't be sold because a skill that needs it is owned (unless the game config allows selling skills with children).
protected override bool DestroyAfterOperate { get; }False: the orb is kept after selling.

Methods​

MemberWhat it is
override void Initialize()Sets up the dependency lock sync and the destroy effect.
override void InitializeSlot(ProgressionSlot slot, Player targetPlayer)Sets the slot and player, then checks the dependency lock.
override void OnConnected(Player player)Server: sends the dependency lock state to a joining player.
void RepositionAndAnchor(BoughtSkillVisualizer boughtSkillVisualizer, ExperienceFillVisualizer visualizer)Joins the orb to the board's anchor body with a fixed joint and links the sell visualizer.
void UpdateDependencyLock(PlayerProgressionManager manager)Server: rechecks whether the skill is locked by dependencies and syncs any change.
protected override void EndInteraction(Interactable arg1, Interactor arg2)Ends the sell progress visual when let go.
protected override void FilterInteraction(Interactor interactor, Interactable interactable, ref bool result)Blocks grabbing while locked by dependencies (playing a locked effect) or while the board is in use.
protected override IEnumerator HeldDurationCheck(Interactor interactor) (iterator)While held away from its spot, fills the sell progress with haptics. When full it sends the operate message and drops the orb.
protected override void Operate(PlayerProgressionManager targetManager)Sells the skill: locks the slot in the player's PlayerProgressionManager, which refunds part of the experience.
2 private and internal methods
MemberWhat it is
private void SceneDestroy(NetworkEntity entity, bool isUnload)Client: plays the orb destroy effect when the entity is destroyed other than by unload.
private void SyncDependencyLock(IPlayer player, Stream stream, bool isLockedByDependencies)Receives the dependency lock state from the server and stores it in IsLockedByDependencies.

Used in​

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