Esempio n. 1
0
    private IEnumerator ChangeDirectionDecision()
    {
        while (true)
        {
            yield return(new WaitForSeconds(Random.Range(stats.MinChangeDirectionDelay.Value, stats.MaxChangeDirectionDelay.Value)));

            behavior.ChangeDirection();
        }
    }
    private void SpawnEnemy()
    {
        GameObject obj = GameObject.Instantiate(waves[current_wave].enemy_template.gameObject);

        obj.transform.position = transform.position;
        EnemyBehavior behavior = obj.GetComponent <EnemyBehavior>();

        behavior.Init(waves[current_wave].enemy);
        behavior.ChangeDirection(start_direction);
    }
Esempio n. 3
0
    void OnTriggerEnter2D(Collider2D col)
    {
        EnemyBehavior enemy = col.gameObject.GetComponent <EnemyBehavior>();

        if (enemy == null)
        {
            return;
        }
        enemy.ChangeDirection(target_direction);
    }