using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseFollow : MonoBehaviour
{
///
/// This method constantly updates as the game goes and it
/// calls the face mouse method.
///
private void Update(){
FaceMouse();
}
///
/// This method checks the mouse position to make the mouse follow
/// the player.
///
private void FaceMouse(){
//Get the position of the mouse in the game and the camera
Vector3 mousePosition = Input.mousePosition;
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
//Check the direction of the mouse
Vector2 direction = transform.position - mousePosition;
transform.right = -direction;
}
}