Compare commits
No commits in common. "586aadaf28a63e474bd27dd0988ae416916a4a4f" and "055fbf0f4d8830625539baa41569768fa6de9c93" have entirely different histories.
586aadaf28
...
055fbf0f4d
6
.idea/.idea.projectZ/.idea/vcs.xml
generated
6
.idea/.idea.projectZ/.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -82557,7 +82557,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6085896215333849443, guid: 6a3d7d21ac1b5f14683645eb9e411130, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -7.053
|
||||
value: -7.4623604
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6085896215333849443, guid: 6a3d7d21ac1b5f14683645eb9e411130, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@ -8,32 +7,27 @@ 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 || _capacity <= 0) return;
|
||||
if (!isServer) return;
|
||||
|
||||
if (_instance == null && _spawnStarted == false)
|
||||
if (_instance == null && spawnStarted == false)
|
||||
{
|
||||
_spawnStarted = true;
|
||||
spawnStarted = true;
|
||||
}
|
||||
|
||||
if (_spawnStarted)
|
||||
if (spawnStarted)
|
||||
{
|
||||
_timer += Time.fixedDeltaTime;
|
||||
}
|
||||
@ -58,7 +52,6 @@ public class CellSpawner : NetworkBehaviour
|
||||
{
|
||||
_instance = Instantiate(prefab, transform.position + transform.up * 1.2f, Quaternion.identity); //* 1.8f
|
||||
NetworkServer.Spawn(_instance);
|
||||
_spawnStarted = false;
|
||||
_capacity--;
|
||||
spawnStarted = false;
|
||||
}
|
||||
}
|
||||
|
@ -12,4 +12,4 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 0}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState
|
||||
lastWriteTicks: -8584910005848256330
|
||||
lastWriteTicks: -8584932388166862069
|
||||
|
Loading…
x
Reference in New Issue
Block a user