コード例 #1
0
    // Enemy Unit Creation Functions
    public EnemyUnit CreateEnemyUnit(int level)
    {
        EnemyUnitData enemyUnitData = unitFactory.CreateEnemyUnitData(level);
        EnemyUnit     enemy         = Instantiate(enemyUnit, enemyUnitSpawnLocation).GetComponent <EnemyUnit>();

        float initialHealth = enemyUnitData.GetMaxHealth();

        if (GameEngine.GetInstance().gameMode == GameMode.EASY)
        {
            initialHealth = Mathf.Floor(initialHealth * 0.6f);
        }
        else if (GameEngine.GetInstance().gameMode == GameMode.NORMAL)
        {
            initialHealth = Mathf.Floor(initialHealth * 0.8f);
        }

        enemy.InitializeEnemyUnitGameObject(enemyUnitData, initialHealth);

        GameEngine.GetInstance().IncrementEnemyUnitCount();

        return(enemy);
    }