Class RespawnCondition
- Namespace
- FishMMO.Server.Implementation.World.SceneServer.Spawner
- Assembly
- FishMMO.Server.dll
A rule a spawner must satisfy before it may respawn anything.
[Serializable]
public abstract class RespawnCondition
- Inheritance
-
RespawnCondition
- Derived
- Inherited Members
Remarks
Plain serialized data, held by UnityEngine.SerializeReference on the ObjectSpawner authoring component and baked into the scene's SceneSpawnTable. It used to be a scene component, which cannot survive the bake: spawners are stripped from shipped scenes, and a condition that referenced other scene objects would have pointed at nothing.
Methods
Bake(RespawnCondition, Func<ObjectSpawner, int>)
Resolves authoring-time references into the baked table. Called by the baker on the
table's copy of authored.
public virtual void Bake(RespawnCondition authored, Func<ObjectSpawner, int> resolveSpawnerIndex)
Parameters
authoredRespawnConditionThe condition as it is authored on the scene's spawner.
resolveSpawnerIndexFunc<ObjectSpawner, int>Maps an authoring spawner in the same scene to its index in the table, or -1 when it is not in the table.
Remarks
References are read from authored, not from this copy: a serialized
copy cannot be trusted to carry references to scene objects.
OnCheckCondition(SpawnerRuntime)
Checks whether the condition allows spawner to respawn now.
public abstract bool OnCheckCondition(SpawnerRuntime spawner)
Parameters
spawnerSpawnerRuntimeThe spawner asking.
Returns
- bool
True if respawn is allowed.