Esempio n. 1
0
    //Based on handmade spawning "blocks":
    public void SpawnSingle(EnemyType enemyType)
    {
        Vector2 spawnLocation = GetRandomPointInsideArea(baseSpawnBorder);
        var     newEnemy      = enemyFactory.Get(enemyType);

        newEnemy.transform.position = new Vector3(spawnLocation.x, newEnemy.transform.position.y, spawnLocation.y);
        enemyCountInWorld++;
    }
Esempio n. 2
0
    void SpawnEnemy()
    {
        GameTile spawnPoint = board.GetSpawnPoint(Random.Range(0, board.SpwanPointCount));
        Enemy    enemy      = enemyFactory.Get();

        enemy.SpawnOn(spawnPoint);
    }
Esempio n. 3
0
        private void GameLoop(object sender, EventArgs e)
        {
            HighScore += ScoreForTick;
            if (Enemies.Any(enemy => CollisionDetector.AreCollided(Batwing, enemy)))
            {
                timer.Stop();
                renderer.ShowEndGameScreen(HighScore);
                return;
            }

            renderer.Clear();
            renderer.Draw(Batwing);

            if (rand.Next(100) < SpawnEnemyChange)
            {
                var enemy = enemiesFactory.Get(renderer.ScreenWidth, rand.Next(renderer.ScreenHeight));
                Enemies.Add(enemy);
                GameObjects.Add(enemy);
            }

            KillEnemiesIfColliding();

            HighScore += Enemies.Count(enemy => !enemy.IsAlive) * ScoreForKill;
            RemoveNotAliveGameObjects();
            UpdateObjectsPositions();
            DrawGameObjects();
        }
Esempio n. 4
0
 public static void SpawnEnemy(EnemyFactory factory, EnemyType type)
 {
     GameTile spawnPoint =
         Instance.board.GetSpawnPoint(Random.Range(0, Instance.board.SpawnPointCount));
     Enemy enemy = factory.Get(type);
     enemy.SpawnOn(spawnPoint);
     Instance.enemies.Add(enemy);
 }
    public void SpawnEnemy(EnemyFactory factory, EnemyType type)
    {
        Enemy enemy = factory.Get(type);

        enemy.player = player;
        enemy.SpawnOn(spawnPoint);
        enemy.SetDestination(destination);
    }
Esempio n. 6
0
    void SpawnEnemy()
    {
        DefenseGameTile spawnPoint = board.GetSpawnPoint(Random.Range(0, board.SpawnPointCount));
        Enemy           enemy      = enemyFactory.Get();

        enemy.SpawnOn(spawnPoint);
        enemies.Add(enemy);
    }
Esempio n. 7
0
    void SpawnEnemy()
    {
        GameTile spawnPoint = gameBoard.GetSpawnPoint(Random.Range(0, gameBoard.spawnPointsCount));
        Enemy    enemy      = enemyFactory.Get();

        enemyCollection.AddEnemy(enemy);
        enemy.SpawnOn(spawnPoint);
    }
Esempio n. 8
0
    // 产生Enemy
    void SpawnEnemy(GameTile tile)
    {
        Enemy enemy = enemyFactory.Get();

        enemy.SpawnOn(tile);

        enemies.Add(enemy);
    }
Esempio n. 9
0
    private void SpawnEnemy(string url)
    {
        GameTile spawnPoint = board.GetRandomSpawnPoint();
        Enemy    enemy      = enemyFactory.Get();

        enemy.SetMaterialUrl(url);
        enemy.SpawnOn(spawnPoint);
        enemies.Add(enemy);
    }
Esempio n. 10
0
    private void SpawnEnemy()
    {
        var spawnPoint = Board.GetSpawnPoint(Random.Range(0, Board.SpawnPointCount));
        var enemy      = EnemyFactory.Get();

        enemy.SpawnOn(spawnPoint);

        _enemies.Add(enemy);
    }
Esempio n. 11
0
    void SpawnEnemy(EnemyData enemyData)
    {
        GameTile spawnPoint = board.GetSpawnPoint(Random.Range(0, board.SpawnPointCount));
        Enemy    enemy      = enemyFactory.Get();

        enemy.SetUp(enemyData);
        enemy.SpawnOn(spawnPoint);
        enemies.Add(enemy);
    }
Esempio n. 12
0
    public static void SpawnEnemy(EnemyFactory facotry, EnemyType type)
    {
        //GameTile spawnPoint = board.GetSpawnPoint(Random.Range(0, board.SpawnPointCount));
        //Enemy enemy = enemyFactory.Get((EnemyType)Random.Range(0, 3));
        GameTile spawnPoint = instance.board.GetSpawnPoint(Random.Range(0, instance.board.SpawnPointCount));
        Enemy    enemy      = facotry.Get(type);

        enemy.SpawnOn(spawnPoint);
        instance.enemies.Add(enemy);
    }
Esempio n. 13
0
    public static void SpawnEnemy(EnemyFactory factory, EnemyType type)
    {
        // lida com nascer inimigos
        GameTile spawnPoint = instance.board.GetSpawnPoint(
            Random.Range(0, instance.board.SpawnPointCount)
            );
        Enemy enemy = factory.Get(type);

        enemy.SpawnOn(spawnPoint);
        instance.enemies.Add(enemy);
    }
Esempio n. 14
0
    public static void SpawnEnemy(EnemyFactory factory, EnemyType type)
    {
        var spawnPoint = instance.board.GetSpawnPoint(
            Random.Range(0, instance.board.SpawnPointCount)
            );
        var enemy = factory.Get((EnemyType)(type));

        enemy.SpawnOn(spawnPoint);

        instance.enemies.Add(enemy);
    }
Esempio n. 15
0
    public static void SpawnEnemy(
        EnemyFactory factory, EnemyConfig enemyConfig
        )
    {
        // lida com nascer inimigos
        GameTile spawnPoint = instance.board.GetSpawnPoint(
            Random.Range(0, instance.board.SpawnPointCount)
            );
        Enemy enemy = factory.Get(enemyConfig.modelo);

        enemy.UpdateAttributes(enemyConfig.vida, enemyConfig.velocidade, enemyConfig.forca);
        enemy.SpawnOn(spawnPoint);
        instance.enemies.Add(enemy);
    }
Esempio n. 16
0
    void ExecuteSummon()
    {
        for (int i = 0; i < summonCount; ++i)
        {
            Vector2 summonPos = Random.insideUnitCircle * summonMaxRadius;
            summonPos += summonPos.normalized * summonMinRadius; //mapping a circle to a donut :)
            summonPos += new Vector2(transform.position.x, transform.position.z);

            var     summoned       = enemyFactory.Get(toSummon);
            Vector3 summonWorldPos = new Vector3(summonPos.x, summoned.transform.position.y, summonPos.y);

            Ray        wallCheck = new Ray(transform.position, summonWorldPos - transform.position);
            RaycastHit hit;
            if (Physics.Raycast(wallCheck, out hit, (summonWorldPos - transform.position).magnitude))
            {
                summonWorldPos = hit.point;
            }

            summoned.transform.position = summonWorldPos;
        }
    }