39 lines
1.1 KiB
C#
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();
|
||
|
}
|
||
|
}
|
||
|
}
|