예제 #1
0
    public Enemy GenerateEnemy(Platform emptyPlatform, int hp = 1)
    {
        var position = emptyPlatform.indexOfLayer == indexOfEmptyLayer
            ? newEnemiesSpawnPoint
            : new Vector3(0, 0, emptyPlatform.layer.GetComponent <SimplePlatformLayer>().distanceBetweenLayer);

        var enemyObject = Object.Instantiate(
            original: enemyPrefab,
            position,
            Quaternion.Euler(0, 0, 0)
            );

        enemyObject.transform.RotateAround(Vector3.zero, Vector3.up, (360 - emptyPlatform.CurrentAngle) + 90);

        var enemy = enemyObject.GetComponent <Enemy>();

        enemy.futureHp = hp;
        enemy.Hp       = hp;
        enemyMover.ConnectEnemy(enemy, emptyPlatform);
        return(enemy);
    }