Пример #1
0
    //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));
    }
Пример #2
0
 public void Start()
 {
     enemyAudioSource     = GetComponent <AudioSource>();
     enemy                = GetComponent <Enemy>();
     enemyShieldCollision = GetComponentInChildren <EnemyShieldCollision>();
 }