コード例 #1
0
ファイル: SlimeSpawner.cs プロジェクト: hetima333/Slimenator
    private void Update()
    {
        _spawnTimer += Time.deltaTime;

        if (!_isActive)
        {
            return;
        }

        if (_spawnTimer > _spawnRate)
        {
            if ((ObjectManager.Instance.GetActiveObjects(_spawner.GetPrefab()) != null))
            {
                if (ObjectManager.Instance.GetActiveObjects(_prefab) != null)
                {
                    if (ObjectManager.Instance.GetActiveObjects(_prefab).Count < (_maxSpawnCount * ObjectManager.Instance.GetActiveObjects(_spawner.GetPrefab()).Count))
                    {
                        int random = Random.Range(0, _elements.GetList().Count);
                        GetSlimeFromPool(random, gameObject.transform.position);
                    }
                }
                else
                {
                    int random = Random.Range(0, _elements.GetList().Count);
                    GetSlimeFromPool(random, gameObject.transform.position);
                }
            }
            _spawnTimer = 0;
        }
    }
コード例 #2
0
    private void Update()
    {
        _spawnTimer += Time.deltaTime;

        if (_spawnTimer > _spawnRate)
        {
            if ((ObjectManager.Instance.GetActiveObjects(_spawner.GetPrefab()) != null))
            {
                if (ObjectManager.Instance.GetActiveObjects(_prefab) != null)
                {
                    if (ObjectManager.Instance.GetActiveObjects(_prefab).Count < (_maxSpawnCount * ObjectManager.Instance.GetActiveObjects(_spawner.GetPrefab()).Count))
                    {
                        GetSlimeFromPool((int)_type, gameObject.transform.position);
                    }
                }
                else
                {
                    GetSlimeFromPool((int)_type, gameObject.transform.position);
                }
            }
            _spawnTimer = 0;
        }
    }