diff --git a/.gitignore b/.gitignore index 7a5cd83..3f4bca1 100644 --- a/.gitignore +++ b/.gitignore @@ -69,4 +69,6 @@ crashlytics-build.properties # Temporary auto-generated Android Assets /[Aa]ssets/[Ss]treamingAssets/aa.meta -/[Aa]ssets/[Ss]treamingAssets/aa/* \ No newline at end of file +/[Aa]ssets/[Ss]treamingAssets/aa/* + +ProjectSettings/RiderScriptEditorPersistedState.asset \ No newline at end of file diff --git a/.idea/.idea.projectZ/.idea/vcs.xml b/.idea/.idea.projectZ/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/.idea.projectZ/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Assets/Scenes/Space.unity b/Assets/Scenes/Space.unity index 7ed859b..30a7566 100644 --- a/Assets/Scenes/Space.unity +++ b/Assets/Scenes/Space.unity @@ -82557,7 +82557,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6085896215333849443, guid: 6a3d7d21ac1b5f14683645eb9e411130, type: 3} propertyPath: m_LocalPosition.x - value: -7.4623604 + value: -7.053 objectReference: {fileID: 0} - target: {fileID: 6085896215333849443, guid: 6a3d7d21ac1b5f14683645eb9e411130, type: 3} propertyPath: m_LocalPosition.y diff --git a/Assets/Scripts/Environment/Energy/CellSpawner.cs b/Assets/Scripts/Environment/Energy/CellSpawner.cs index ed2367d..76b5bdd 100644 --- a/Assets/Scripts/Environment/Energy/CellSpawner.cs +++ b/Assets/Scripts/Environment/Energy/CellSpawner.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -7,27 +8,32 @@ public class CellSpawner : NetworkBehaviour { public GameObject prefab; public float spawnTime; - + private int _capacity; + + private CustomNetworkManager _networkManager; private GameObject _instance; - private bool spawnStarted = false; + private bool _spawnStarted = false; private float _timer; + void Start() { if (!isServer) return; + _capacity = _networkManager.maxConnections; + Console.WriteLine(_capacity); SpawnPref(); } void FixedUpdate() { - if (!isServer) return; + if (!isServer || _capacity <= 0) return; - if (_instance == null && spawnStarted == false) + if (_instance == null && _spawnStarted == false) { - spawnStarted = true; + _spawnStarted = true; } - if (spawnStarted) + if (_spawnStarted) { _timer += Time.fixedDeltaTime; } @@ -52,6 +58,7 @@ public class CellSpawner : NetworkBehaviour { _instance = Instantiate(prefab, transform.position + transform.up * 1.2f, Quaternion.identity); //* 1.8f NetworkServer.Spawn(_instance); - spawnStarted = false; + _spawnStarted = false; + _capacity--; } } diff --git a/ProjectSettings/RiderScriptEditorPersistedState.asset b/ProjectSettings/RiderScriptEditorPersistedState.asset deleted file mode 100644 index aa1cc2e..0000000 --- a/ProjectSettings/RiderScriptEditorPersistedState.asset +++ /dev/null @@ -1,15 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &1 -MonoBehaviour: - m_ObjectHideFlags: 61 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 0} - m_Name: - m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState - lastWriteTicks: -8584909967537151917