There was an issue with players and enemies overlapping.
Cannot move player after Mover.stop - Unity Courses / Ask - GameDev.tv
I solved it after reading this article.
using RPG.Movement;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RPG.Combat
{
public class Fighter : MonoBehaviour
{
[SerializeField] float weaponRange = 2f;
Transform target;
private void Update()
{
// I added this code.
if (target == null) return;
bool isInRange = Vector3.Distance(transform.position, target.position) < weaponRange;
if (target != null && !isInRange)
{
GetComponent<Mover>().MoveTo(target.position);
}
else
{
GetComponent<Mover>().Stop();
// I added this code.
target = null;
}
}
public void Attack(CombatTarget combatTarget)
{
target = combatTarget.transform;
}
}
}
However, the lecture-like phenomenon did not occur.
A phenomenon where players come and go.
Can I watch the next lecture?
Can I continue?