ExtraArrowUpdater
A class in Root.Township, the global namespace.
Bow component that spawns extra arrows next to the knocked one, keeps them lined up while the string is drawn, and fires them with the main shot. Used by the multi-arrow and light beam skills; the server spawns and syncs the arrows.
- Listed in Global namespace: E to H
- Inherits or implements
NetworkEntityBehaviour - Nested types
ExtraArrowData
Constructors
| Member | What it is |
|---|---|
ExtraArrowUpdater() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
10 private and internal fields
| Member | What it is |
|---|---|
private IUnityUpdateMethod alignArrows | Handle for the registered late update that runs AlignExtraArrows. |
private ImpactTool arrowImpactTool | ImpactTool of the knocked arrow, used to scale extra arrow damage. |
private BowString bowString | The BowString this updater serves. |
private PlayerCharacter interactingPlayer | Player holding the bow string, or null. |
private bool isAligningArrows | True while extra arrows are synced and following the knocked arrow; late joiners get them only then. |
private static Logger logger | NLog logger for this class. |
private List<ExtraArrowUpdater.ExtraArrowData> spawnedExtraArrows | Backing list for SpawnedExtraArrows. |
private MethodSync stopAligningArrows | Network message that tells clients to clear their extra arrows. |
private MethodSyncClass<List<ExtraArrowUpdater.ExtraArrowData>> syncExtraArrows | Network message that sends a list of extra arrows to clients. |
private List<ExtraArrowUpdater.ExtraArrowData> unsyncedExtraArrows | Arrows created since the last sync; cleared once sent. |
Properties
| Member | What it is |
|---|---|
List<ExtraArrowUpdater.ExtraArrowData> SpawnedExtraArrows { get; } | The extra arrows currently attached to the bow. |
1 private and internal property
| Member | What it is |
|---|---|
private Pickup KnockedArrow { get; } | The pickup currently docked on the bow string, or null. |
Methods
| Member | What it is |
|---|---|
IShootable CreateExtraArrow(Vector3 arrowLocalOffset, NetworkPrefab extraArrowPrefab, float damageMultiplier) | Spawns an extra arrow from the prefab at a local offset, sets its damage from the knocked arrow and owner, and turns off its collisions. Returns null with no knocked arrow. |
void DestroyAllExtraArrows() | Destroys every spawned extra arrow entity and clears the list. |
override void Initialize() | Creates the sync methods and hooks the bow string's shoot, dock and grab events. |
override void OnConnected(Player player) | Sends the current extra arrows to a joining player if they are being aligned. |
void SyncExtraArrowsAndStartUpdating() | Server: sends newly created arrows to the chunk and starts aligning them each frame. |
13 private and internal methods
| Member | What it is |
|---|---|
private void AlignExtraArrows() | Late update: moves each extra arrow to the knocked arrow's position plus its offset and copies its rotation. |
private void ClearArrowImpactTool(Interactor interactor, Pickup pickup, PickupDock dock) | Clears arrowImpactTool when an arrow leaves the string dock. |
private void ClearBowStringPlayerInteractor(Interactable arg1, Interactor arg2) | Clears interactingPlayer when the bow string is let go. |
private void DisableExtraArrowCollisions(ExtraArrowUpdater.ExtraArrowData spawnedArrow) | Turns off the new arrow's ColliderGroup and stores it on the arrow data. |
private void GetArrowImpactTool(Interactor interactor, Pickup pickup, PickupDock dock) | Stores the docked arrow's ImpactTool when an arrow is knocked, for damage scaling. |
private void GetBowStringPlayerInteractor(Interactable arg1, Interactor arg2) | Stores the player who grabbed the bow string, used as damage owner and for collision ignoring. |
private void IgnoreCollisionsBetweenArrows(ExtraArrowUpdater.ExtraArrowData newArrow) | Makes a new extra arrow ignore the other extra arrows, the knocked arrow, the bow and the player's body. |
private void RemoveExtraArrows() | Stops aligning and clears the list without destroying. On the server, tells clients to stop too. |
private void Reset() | Editor reset: fills bowString from the same object. |
private void ShootExtraArrows(BowString arg1, NetworkEntity shotEntity, Vector3 shotVelocity) | Runs when the bow fires: unparents and shoots each extra arrow with the main velocity. Server re-enables their colliders after 0.07 seconds. |
private void StartAligningArrowsOnClient() | Client: registers AlignExtraArrows on late update after the arrows are received. |
private void StopAligningArrows(IPlayer player, Stream stream) | Receive handler for the stop message; clears the extra arrows on the client. |
private void SyncExtraArrows(IPlayer player, Stream stream, List<ExtraArrowUpdater.ExtraArrowData> arrowsToSync) | Writes or reads the arrow entity IDs and offsets. Clients parent the arrows to the bow, disable their colliders and start aligning. |
Used in
Members of other types that take, return or hold a ExtraArrowUpdater: