Skip to main content

DockByDefault

A class in Root.Township, the global namespace.

Server-side generator that fills a dock with a random number of an item the first time the entity is generated.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private int countMaxUpper bound of the random count.
private int countMinLower bound of the random count. Nothing spawns if the count is 0.
private PickupDock dockThe dock to fill.
private Item itemThe item to spawn into the dock.

Properties​

MemberWhat it is
protected override bool IsGeneratingFirstTime { get; }Always true, so it generates when the entity is first created.

Methods​

MemberWhat it is
protected override void Generate(SpawnData spawnData)Spawns a random count of item into dock. The count is floored, so countMax is only reached when both bounds match.