private void Start()
        {
            _player       = GameObject.FindGameObjectWithTag("Player").transform;
            _playerHealth = _player.GetComponent <PlayerHealth>();
            healthBar.SetMaxHealth(health);
            _rb             = GetComponent <Rigidbody2D>();
            _sprite         = GetComponent <SpriteRenderer>();
            _follower       = GetComponent <PathFolower>();
            _follower.speed = speed;
            _follower.StartFollow();

            _sounds = GetComponent <EnemySound>();

            if (_sounds == null)
            {
                Debug.LogError("EnemySound.cs is missing on the " + gameObject.name + " gameObject!");
            }
        }
Example #2
0
 private void OnEnable()
 {
     folower = (PathFolower)target;
 }