void Update() { if (_hasCreatingUnit) { _timeBeforeSpawn -= Time.deltaTime; if (_timeBeforeSpawn <= 0) { Quaternion unitRotation = new Quaternion(); unitRotation.eulerAngles = _spawnRotation; unitRotation = transform.rotation * unitRotation; UnitAI newUnit = GameObjectManager.CreateObject(_currentTaskData.Prefab, PositionChecker.FindNearestFreePosition(transform.TransformPoint(_spawnPoint)), unitRotation).GetComponent <UnitAI>(); GameObjectManager.AddToPlayerObjectsList(OwnerPlayer, newUnit.transform); ////отправка юнита в пункт сбора //var message = new TaskDataMessage { // TaskData = new FollowToPoint_Task.FollowToPoint_TaskData(AssemblyPoint ), // NewQueue = true //}; //newUnit.AddTask(message); DequeueUnitData(); } } }