Exemplo n.º 1
0
        // Create an enemy of a specific type.
        private void CreateEnemy(string unitType)
        {
            // create a new enemy unit
            EnemyUnit enemyUnit;

            // check the unit type
            if (unitType == EnemyUnit.LARGE_ENEMY)
            {
                // create a large enemy unit
                enemyUnit = new LargeEnemy();
            }
            else if (unitType == EnemyUnit.MEDIUM_ENEMY)
            {
                // create a medium enemy
                enemyUnit = new MediumEnemy();
            }
            else
            {
                // create a small enemy
                enemyUnit = new SmallEnemy();
            }
            // setup the unit boxes in the default location
            enemyUnit.SpawnEnemy(unitType);
            // add it to the list
            enemyUnits.Add(enemyUnit);
            // calculate the amount of enemies remaining
            amountOfEnemiesRemaining -= 1;
        }
Exemplo n.º 2
0
        // Create an enemy given recorded information
        private void CreateSpecificEnemy(string unitType, int enemyUnitHealth, int enemyUnitBoxX, int enemyUnitHealthBoxY)
        {
            // create a new enemy unit
            EnemyUnit enemyUnit;

            // check the unit type
            if (unitType == EnemyUnit.LARGE_ENEMY)
            {
                // create a large enemy unit
                enemyUnit = new LargeEnemy();
            }
            else if (unitType == EnemyUnit.MEDIUM_ENEMY)
            {
                // create a medium enemy
                enemyUnit = new MediumEnemy();
            }
            else
            {
                // create a small enemy
                enemyUnit = new SmallEnemy();
            }
            // load the enemy boxes into specific locations
            enemyUnit.LoadEnemy(unitType, enemyUnitHealth, enemyUnitBoxX, enemyUnitHealthBoxY);
            // add it to the list
            enemyUnits.Add(enemyUnit);
            // calculate the amount of enemies remaining
            amountOfEnemiesRemaining -= 1;
        }