OldBlueWater/BlueWater/Assets/02.Scripts/AssaultMode/Boat.cs
2023-08-09 16:47:55 +09:00

29 lines
602 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Boat : MonoBehaviour
{
private NavMeshAgent agent;
private void Awake()
{
agent = GetComponent<NavMeshAgent>();
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 1000f))
{
agent.SetDestination(hit.point);
}
}
}
}