private void Update() { if (EnemyAIManager.huntHero) { movement.Disengage(); if (Vector3.Distance(gameObject.transform.position, GameManager.Instance.Player. transform.position) <= sMinioninfo.AgroRange + 30.0f) { movement.SetTarget(GameManager.Instance.Player.transform, sMinioninfo.AgroRange); } } if (0 == targets.Count || !targets[0] || !targets[0].gameObject.GetComponent <Info>(). Alive) { movement.Disengage(); targets.RemoveAll(item => (!item || !item.gameObject.activeInHierarchy)); if (1 <= targets.Count && !targets[0].gameObject.GetComponent <Info>().Alive) { AttackTriggerExit(targets[0].gameObject); } } else if (movement.InCombat && movement.WithinRange) { weapon.transform.LookAt(targets[0].position); weaponDetails.Shoot(); } else if (!movement.InCombat) { movement.SetTarget(targets[0], sMinioninfo.Range); } }
private void Update() { second -= Time.deltaTime * Minioninfo.AttackSpeed; if (0 == targets.Count || !targets[0] || !targets[0].GetComponent <Info>().Alive) { movement.Disengage(); targets.RemoveAll(item => !item || !item.gameObject.activeInHierarchy); if (0 < targets.Count && !targets[0].GetComponent <Info>().Alive) { AttackTriggerExit(targets[0].gameObject); } } else if (movement.InCombat && movement.WithinRange && second <= 0.0f) { if (attackParticles) { attackParticles.Play(); } FireAtTarget(targets[0], Minioninfo.Damage); AudioManager.PlaySoundEffect(AudioManager.sfxMinionAttack, transform.position); second = 1.0f; } else if (!movement.InCombat) { if (targets[0].GetComponent <PortalInfo>()) { movement.SetTarget(targets[0], Minioninfo.Range + 30.0f); } else { movement.SetTarget(targets[0], Minioninfo.Range); } } }