CapersProject/Assets/02.Scripts/Character/Npc/Crew/CleanerCrew.cs
2024-10-14 20:13:08 +09:00

39 lines
1.1 KiB
C#

using BlueWater.Interfaces;
using UnityEngine;
namespace BlueWater.Npcs.Crews
{
public class CleanerCrew: Crew
{
public void OnMission(ICrewInteraction crewInteraction)
{
CrewInteraction = crewInteraction;
CrewInteraction.OnInteractionCompleted += InteractionCompleted;
IsOnMission = true;
}
public void ResetMission()
{
CrewInteraction = null;
IsOnMission = false;
IsCleaningFloor = false;
IsCleaningTable = false;
}
public bool CanInteractionPosition()
{
if (CrewInteraction.CenterTransform == null) return false;
return AIMovement.HasReachedDestination() ||
Vector3.Distance(CrewInteraction.CenterTransform.position, transform.position) <=
CrewInteraction.InteractionRadius;
}
private void InteractionCompleted()
{
CrewInteraction.OnInteractionCompleted -= InteractionCompleted;
ResetMission();
}
}
}