//set up all necessary attributes and apply the effects to yourself public void SetupEnemy(EnemyType et, EnemyCurvePath ecp) { enemyType = et; enemyCurvePath = ecp; enemyHealth = GetComponent <EnemyHealth>(); enemyHealth.SetupHealth(enemyType); enemyShieldCollision = GetComponentInChildren <EnemyShieldCollision>(); foreach (EnemyEffect e in enemyType.enemyEffects) { e.Apply(this); } canMove = true; //interestingly, ScriptableObjects can contain the definition for coroutines and //run them on an external MonoBehaviour, which is what happens here StartCoroutine(enemyCurvePath.MoveTowardsTarget(this)); }
public void Start() { enemyAudioSource = GetComponent <AudioSource>(); enemy = GetComponent <Enemy>(); enemyShieldCollision = GetComponentInChildren <EnemyShieldCollision>(); }