private void buildFinalBossWave(EnemyWave newWave, ContentManager _content)
        {
            _creator = new ConcreteFinalBossCreator();
            Vector2 pos = new Vector2(300, 50);

            newWave.addEnemy(_creator.CreateEnemy(pos, Vector2.One, _content, new EnemyMovements()));
        }
 private void buildGruntAWave2(EnemyWave newWave, ContentManager _content)
 {
     _creator = new ConcreteGruntACreator();
     for (int j = 0; j < 4; j++)
     {
         EnemyMovements moves = new EnemyMovements();
         for (int i = 0; i < 10; i++)
         {
             moves.addMovement(new MoveDown(3.0));
             moves.addMovement(new MoveUp(3.0));
         }
         Vector2 pos = new Vector2(j * 100, 0);
         Vector2 vel = new Vector2(-1, 1);
         newWave.addEnemy(_creator.CreateEnemy(pos, vel, _content, moves));
     }
 }
        private void buildGruntBWave1(EnemyWave newWave, ContentManager _content)
        {
            _creator = new ConcreteGruntBCreator();
            int height = 50;

            for (int j = 1; j < 5; j++)
            {
                EnemyMovements moves = new EnemyMovements();
                for (int i = 0; i < 10; i++)
                {
                    moves.addMovement(new MoveLeft(6.0));
                    moves.addMovement(new MoveRight(6.0));
                }
                Vector2 pos = new Vector2(800 - (j * 100), height);
                Vector2 vel = new Vector2(-1, 1);
                newWave.addEnemy(_creator.CreateEnemy(pos, vel, _content, moves));
                height += 100;
            }
        }
        private void buildGruntBWave2(EnemyWave newWave, ContentManager _content)
        {
            _creator = new ConcreteGruntBCreator();
            int width = 350;

            for (int j = 1; j < 5; j++)
            {
                EnemyMovements moves = new EnemyMovements();
                for (int i = 0; i < 10; i++)
                {
                    moves.addMovement(new MoveUp(3.0));
                    moves.addMovement(new MoveDown(3.0));
                }
                Vector2 pos = new Vector2(width, 300);
                Vector2 vel = new Vector2(-1, 1);
                newWave.addEnemy(_creator.CreateEnemy(pos, vel, _content, moves));
                width += 100;
            }
        }
Exemplo n.º 5
0
    public override void OnInspectorGUI()
    {
        EnemyCreator enemy = (EnemyCreator)target;

        EditorGUILayout.LabelField("Create an enemy bot");
        enemy.prefab       = (GameObject)EditorGUILayout.ObjectField("Enemy Prefab", enemy.prefab, typeof(GameObject), true);
        enemy.position     = (Vector3)EditorGUILayout.Vector3Field("Enemy Position", enemy.position);
        enemy.visionRadius = (float)EditorGUILayout.FloatField("Vision Collider Radius", enemy.visionRadius);
        enemy.speed        = (float)EditorGUILayout.FloatField("Enemy Speed", enemy.speed);
        if (GUILayout.Button("Create Enemy"))
        {
            if (enemy.CreateEnemy())
            {
                GUILayout.Box("Inimigo criado com sucesso!");
            }
            else
            {
                GUILayout.Box("Falha ao criar!");
            }
        }
    }
        private void buildWaveFromFile(EnemyWave newWave, String filename, ContentManager _content)
        {
            waveObj JSON = JsonConvert.DeserializeObject <waveObj>(File.ReadAllText(dirpath + filename));

            //'C:\Users\elifo\Desktop\MyStuff\School Projects\487sp19_bulletgame\content\BulletGame\wave5.json'.'
            for (int enemyIdx = 0; enemyIdx < JSON.enemies.Count; enemyIdx++)
            {
                if (JSON.enemies[enemyIdx].type == "GruntA")
                {
                    _creator = new ConcreteGruntACreator();
                }
                else if (JSON.enemies[enemyIdx].type == "GruntB")
                {
                    _creator = new ConcreteGruntBCreator();
                }
                else if (JSON.enemies[enemyIdx].type == "MidBoss")
                {
                    _creator = new ConcreteMidBossCreator();
                }
                else if (JSON.enemies[enemyIdx].type == "FinalBoss")
                {
                    _creator = new ConcreteFinalBossCreator();
                }
                EnemyMovements  moves           = new EnemyMovements();
                MovementFactory movementFactory = new MovementFactory();
                for (int rep = 0; rep < JSON.enemies[enemyIdx].movementRepetitions; rep++)
                {
                    for (int moveIdx = 0; moveIdx < JSON.enemies[enemyIdx].movements.Count; moveIdx++)
                    {
                        moves.addMovement(movementFactory.makeMovement(JSON.enemies[enemyIdx].movements[moveIdx].type, JSON.enemies[enemyIdx].movements[moveIdx].duration));
                    }
                }

                Vector2 pos = new Vector2(JSON.enemies[enemyIdx].startPos[0], JSON.enemies[enemyIdx].startPos[1]);
                Vector2 vel = new Vector2(JSON.enemies[enemyIdx].startVel[0], JSON.enemies[enemyIdx].startVel[1]);
                newWave.addEnemy(_creator.CreateEnemy(pos, vel, _content, moves));
            }
        }