Ejemplo n.º 1
0
        public override void _Ready()
        {
            _sacrificialItems = new List <PlayerModifierTypes.SacrificialItem>();
            _shopItems        = new List <PlayerModifierTypes.ShopItem>();

            _playerIsInside = false;
            _parentGroup    = GetNode <EnemyGroup>(parentGroupNodePath);

            Connect("body_entered", this, nameof(HandlePlayerEntry));
            Connect("body_exited", this, nameof(HandlePlayerExit));
        }
Ejemplo n.º 2
0
        private void SpawnEnemyGroup()
        {
            GD.Print($"Spawning Enemy Group: {_currentEnemyGroups}");

            int             randomIndex   = (int)(GD.Randi() % _availableWorldSpawnPoints.Count);
            EnemySpawnPoint spawnNode     = _availableWorldSpawnPoints[randomIndex];
            Vector2         spawnPosition = spawnNode.GetGlobalPosition();

            EnemyGroup enemyGroupInstance = (EnemyGroup)enemyGroupPrefab.Instance();

            spawnNode.AddChild(enemyGroupInstance);
            _enemyGroupsSpawned.Add(enemyGroupInstance);

            enemyGroupInstance.SetEnemyGroupColors(
                enemyGroupColors[GD.Randi() % enemyGroupColors.Length],
                (GradientTexture)enemyGroupGradients[(int)(GD.Randi() % enemyGroupGradients.Count)]
                );

            enemyGroupInstance.ActivateEnemySpawning(spawnNode.GetEnemyDangerLevel());
            enemyGroupInstance.SetGlobalPosition(spawnPosition);

            _availableWorldSpawnPoints.RemoveAt(randomIndex);
        }