Skip to main content

Pinboard

A class in Root.Township, Alta.Pages.

Server: a board pages can be pinned to by dropping them in its pickup area. Looks unfinished: AddPage never counts pages and always returns false, so dropped pages are re-parented but never removed.

Constructors​

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

Fields​

11 private and internal fields
MemberWhat it is
private TextRenderer countTextText for the page count; not used here.
private float heightBoard height, for the gizmo.
private List<Pickup> hoveringPickups in the area being watched.
private int maximumMost pages the board takes (10); not serialized.
private TextRenderer maximumTextText for the maximum; not used here.
private List<PageInstance> pagesPinned pages; nothing adds to it.
private PickupArea pickupAreaArea that detects pages held over the board.
private GameObject pinAssetPin object spawned for each pinned page.
private Vector2 pinOffsetOffset of the pin from the page position.
private List<GameObject> pinsPin objects spawned.
private float widthBoard width, for the gizmo.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)Server: hooks the pickup area's added and removed events.
7 private and internal methods
MemberWhat it is
private bool AddPage(PageInstance page)Parents the page to the board at its drop spot and adds a pin, unless full. Always returns false and never adds to pages.
private void CheckInsert(Interactable pickup, Interactor interactor)When a hovering page is let go, tries AddPage and destroys the page entity if it returns true.
private void ListenForPageDrop(Pickup pickup)Starts watching a pickup that entered the area for being let go.
private void OnDrawGizmosSelected()Editor: draws the board's area as a cyan box.
private void StartListeningForDrops()Turns the pickup area on; not called here.
private void StopListenForPageDrop(Pickup pickup)Stops watching a pickup that left the area.
private void StopListeningForDrops()Turns the pickup area off and stops watching all pickups; not called here.