Esempio n. 1
0
    public static EnemyHandler CreateEnemy(Vector3 spawnPosition, PlayerHandler playerHandler)
    {
        Transform    enemyTransform = Instantiate(GameAssets.i.pfEnemyTransform, spawnPosition, Quaternion.identity);
        EnemyHandler enemyHandler   = enemyTransform.GetComponent <EnemyHandler>();

        HealthSystem healthSystem = new HealthSystem(150 + (GameControl.control.lvl * 10));
        HealthBar    healthBar    = Instantiate(GameAssets.i.pfHealthBar, spawnPosition + new Vector3(0, 1.5f), Quaternion.identity, enemyTransform).GetComponent <HealthBar>();

        healthBar.Setup(healthSystem);

        enemyHandler.Setup(playerHandler, healthSystem);

        return(enemyHandler);
    }