public override void Act(GameObject player, GameObject npc) { if (Vector3.Distance(npc.transform.position, destination) <= 0.2f) { FindNextPoint(); } Vector2 velocity = aiMovement.CalculateVelocity(); aiMovement.Move(velocity * Time.deltaTime); aiMovement.SetDirection(destination); }
public override void Act(GameObject player, GameObject npc) { Vector2 velocity = aiMovement.CalculateVelocity(); aiMovement.Move(velocity * Time.deltaTime); if (aiMovement.collisions.touchedPlayerHorizontally) { npc.GetComponent <NPCController>().animator.SetTrigger("TouchPlayerHorizontally"); } aiMovement.SetDirection(player.transform.position); }