Skip to content

Commit 1434c81

Browse files
committed
feat(map): add max players to map data
1 parent 24b3327 commit 1434c81

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

Assets/Resources/ScriptableObjects/Maps/Map1.asset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ MonoBehaviour:
1414
m_EditorClassIdentifier:
1515
mapName: The Hills
1616
mapSize: 200
17+
maxPlayers: 2
1718
sceneName: Map1

Assets/Scripts/ScriptableObjects/MapData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public class MapData : ScriptableObject
66

77
public string mapName;
88
public float mapSize;
9+
public int maxPlayers;
910

1011
public string sceneName;
1112
}

Assets/Scripts/Tools/MapMetadataExtractor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public static void Extract(Scene s)
4949
Bounds bounds = terrain.terrainData.bounds;
5050
data.mapSize = bounds.size.x;
5151

52+
// get the max number of players = number of spawnpoints
53+
data.maxPlayers = GameObject.Find("Spawnpoints").transform.childCount;
54+
5255
// update the Scriptable Object
5356
EditorUtility.SetDirty(data);
5457
AssetDatabase.SaveAssets();

0 commit comments

Comments
 (0)