31 lines
596 B
C#
31 lines
596 B
C#
using UFS2.Gameplay;
|
|
using UnityEngine;
|
|
|
|
public class FishInterestState : IState
|
|
{
|
|
private FishEntity entity;
|
|
|
|
public FishInterestState(FishEntity entity)
|
|
{
|
|
this.entity = entity;
|
|
}
|
|
|
|
public void Enter()
|
|
{
|
|
}
|
|
|
|
public void Execute()
|
|
{
|
|
Vector3 direction = entity.transform.position - entity.Target.position;
|
|
entity.Physics.MoveInDirection(direction, entity.Data.MoveSpeed, entity.Data.RotateSpeed, Time.deltaTime, ForceMode.VelocityChange);
|
|
if (Vector3.Distance(entity.transform.position, entity.Target.position) > 3f)
|
|
{
|
|
entity.LostAttract();
|
|
}
|
|
}
|
|
|
|
public void Exit()
|
|
{
|
|
}
|
|
}
|