// Update is called once per frame void Update() { enemyAnim.Idle(); if (meshNav.enabled) { float dist = Vector3.Distance(player.transform.position, this.transform.position); bool shoot = false; bool follow = (dist < followDistance); if (follow) { float random = Random.Range(0.0f, 1.0f); if (random > (1.0f - attackProbability) && dist < attackDistance) { ShootEvent(); } } if (follow) { meshNav.SetDestination(player.transform.position); enemyAnim.Run(); enemySound.PlayOneShot(followSound, 1f); } } }
// Start is called before the first frame update void Start() { meshNav = GetComponent <NavMeshAgent>(); enemySound = GetComponent <AudioSource>(); enemyAnim = GetComponent <buttonControl_script>(); if (gameObject.name == "mummy@idle01") { enemyAnim.Idle(); } }
public void EnemyIdle() { _actions.Idle(); }