CharacterInitialSpawnPositionDetails - jimdroberts/FishMMO GitHub Wiki
CharacterInitialSpawnPositionDetails is a serializable class for FishMMO that contains details for a character's initial spawn position, including location, rotation, and allowed races. It is used to specify where and how a character should be placed when initially spawning in the game world, and to restrict spawn eligibility by race.
-
public string SpawnerName
The name of the spawner associated with this initial spawn position.
-
public string SceneName
The name of the scene where the character will spawn.
-
public Vector3 Position
The world position where the character will initially spawn.
-
public Quaternion Rotation
The rotation to apply to the character at the initial spawn position.
-
public List AllowedRaces
List of races allowed to spawn at this position.
- Create a new CharacterInitialSpawnPositionDetails instance and set the SpawnerName, SceneName, Position, Rotation, and AllowedRaces fields as needed.
- Use this class to store and retrieve initial spawn location data for characters.
// Example 1: Creating and configuring initial spawn position details
CharacterInitialSpawnPositionDetails details = new CharacterInitialSpawnPositionDetails();
details.SpawnerName = "StartZoneSpawner";
details.SceneName = "StartZone";
details.Position = new Vector3(0, 1, 0);
details.Rotation = Quaternion.identity;
details.AllowedRaces = new List<RaceTemplate> { race1, race2 };
// Example 2: Using spawn details to set a character's transform
character.transform.position = details.Position;
character.transform.rotation = details.Rotation;
- Set all fields to ensure correct placement, orientation, and eligibility for initial spawns.
- Use AllowedRaces to restrict spawn points for specific races and enhance gameplay control.
- Document the intended use of each initial spawn position for maintainability.