private void Update() { if (b_see_the_player) { /*if (f_current_time_to_shot >= 0) * { * f_current_time_to_shot -= Time.deltaTime; * } * else if (f_current_time_to_shot < 0) * { * Shot(); * }*/ Quaternion newRotation = Quaternion.LookRotation(Script_Player.Instance.transform.position - obj_guard_sign_of_view.position, Vector3.forward); LookAtSomething(newRotation, f_sign_of_view_rotation_speed_player_saw); anim_guard_animator.SetBool("IsAiming", true); } else { anim_guard_animator.SetBool("IsAiming", false); if (f_current_time_chase_player >= 0) { f_current_time_chase_player -= Time.deltaTime; } else if (f_current_time_chase_player < 0) { StopChasing(); } float hDistance = Mathf.Abs(ai_path_component.GetNextPosition().x - transform.position.x); float vDistance = Mathf.Abs(ai_path_component.GetNextPosition().y - transform.position.y); if (vDistance >= hDistance) { if (transform.position.y > ai_path_component.GetNextPosition().y) { guard_idle_direction = GuardBaseDirection.Up; SetGuardDirection(); anim_guard_animator.SetFloat("VMove", 1); //Debug.Log("GO UP"); } else if (transform.position.y < ai_path_component.GetNextPosition().y) { guard_idle_direction = GuardBaseDirection.Down; SetGuardDirection(); anim_guard_animator.SetFloat("VMove", -1); //Debug.Log("GO DOWN"); } anim_guard_animator.SetFloat("HMove", 0); } else { if (transform.position.x > ai_path_component.GetNextPosition().x) { guard_idle_direction = GuardBaseDirection.Right; SetGuardDirection(); anim_guard_animator.SetFloat("HMove", 1); // Debug.Log("GO right"); } else if (transform.position.x < ai_path_component.GetNextPosition().x) { guard_idle_direction = GuardBaseDirection.Left; SetGuardDirection(); anim_guard_animator.SetFloat("HMove", -1); //Debug.Log("GO left"); } anim_guard_animator.SetFloat("VMove", 0); } } }