Пример #1
0
        public void RunWave(float delta)
        {
            _elapsedTime += delta;             // keeps wave spawn time
            Debug.Assert(_factory != null, nameof(_factory) + " != null");
            Debug.Assert(_gamePath != null, nameof(_gamePath) + " != null");
            Debug.Assert(_playerBase != null, nameof(_gamePath) + "!= null");
            if (_factory !.CanSpawnMoreEnemies())
            {
                if (_elapsedTime < _factory.SpawnDelay)
                {
                    return;
                }
                if (_gamePath != null && _playerBase != null)
                {
                    var newEnemy = _factory.CreateEnemies(_gamePath, _playerBase);
                    if (newEnemy != null)
                    {
                        _factory.AddChild(newEnemy);
                    }
                }

                _elapsedTime = 0;
            }