/// <summary> /// Tries to get the <see cref="Vector3"/> used for a specific <see cref="SpawnLocation"/>. /// </summary> /// <param name="location">The <see cref="SpawnLocation"/> to check.</param> /// <returns>The <see cref="Vector3"/> used for that spawn location. Can be <see cref="Vector3.zero"/>.</returns> public static Vector3 GetPosition(this SpawnLocation location) { Transform transform = location.GetDoor(); if (transform == null) { return(default);
public static Vector3 TryGetLocation(this SpawnLocation location) { Vector3 pos = Vector3.zero; float modifier = SpawnLocationData.ReversedLocations.Contains(location) ? -3f : 3f; Transform transform = location.GetDoor(); if (transform != null) { pos = (transform.position + (Vector3.up * 1.5f)) + (transform.forward * modifier); } return(pos); }