Esempio n. 1
0
        void Start()
        {
            Agent = GetComponent<NavMeshAgent>();
            Attack = GetComponent<EnemyAttack>();

            _enemyCharacter = GetComponent<EnemyCharacter>();
            _health = _enemyCharacter.GetComponent<EnemyHealth>();
        }
Esempio n. 2
0
        void Start()
        {
            Health = Player.GetComponent<Health>();
            _animator = GetComponent<Animator>();
            _enemyHealth = GetComponent<EnemyHealth>();
            _timeBetweenAttacks = AnimationClip.length;
            _timer = _timeBetweenAttacks;

            Initialize();
        }
        // Use this for initialization
        void Start()
        {
            _agent = GetComponent<NavMeshAgent>();
            _character = GetComponent<EnemyCharacter>();
            _health = _character.GetComponent<EnemyHealth>();

            // Time between an attack is the length of time it takes for the animation to complete
            // This is divided by 2 here because the Attacking state doubles the speed of the animation, so that needs to be adjusted here too
            _timeBetweenAttack = (AttackAnimation.length / 2) / 4f;

            _agent.updateRotation = false;
            _agent.updatePosition = true;
        }
Esempio n. 4
0
 private void Awake()
 {
     _players     = GameObject.FindGameObjectsWithTag("Player");
     _enemyHealth = GetComponent <EnemyHealth>();
     _anim        = GetComponent <Animator> ();
 }