2022-03-18 20:49:44 +00:00
|
|
|
|
using GhostEnums;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace QSB.EchoesOfTheEye.Ghosts.Actions;
|
|
|
|
|
|
|
|
|
|
public class QSBWaitAction : QSBGhostAction
|
|
|
|
|
{
|
|
|
|
|
public override GhostAction.Name GetName()
|
|
|
|
|
{
|
|
|
|
|
return GhostAction.Name.Wait;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override float CalculateUtility()
|
|
|
|
|
{
|
2022-04-02 09:54:12 +00:00
|
|
|
|
if (_data.interestedPlayer == null)
|
|
|
|
|
{
|
|
|
|
|
return 0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PlayerState.IsGrabbedByGhost() && (_running || _data.interestedPlayer.timeSincePlayerLocationKnown < 4f))
|
2022-03-18 20:49:44 +00:00
|
|
|
|
{
|
|
|
|
|
return 666f;
|
|
|
|
|
}
|
2022-04-02 09:54:12 +00:00
|
|
|
|
|
2022-03-18 20:49:44 +00:00
|
|
|
|
return 0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnEnterAction()
|
|
|
|
|
{
|
|
|
|
|
if (!PlayerState.IsGrabbedByGhost())
|
|
|
|
|
{
|
2022-04-07 07:57:51 +00:00
|
|
|
|
_controller.AttachedObject.StopMoving();
|
|
|
|
|
_controller.AttachedObject.StopFacing();
|
2022-03-18 20:49:44 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2022-04-02 09:54:12 +00:00
|
|
|
|
|
|
|
|
|
_effects.AttachedObject.SetMovementStyle(GhostEffects.MovementStyle.Stalk);
|
2022-04-07 07:57:51 +00:00
|
|
|
|
_controller.AttachedObject.FacePlayer(TurnSpeed.MEDIUM);
|
2022-04-02 09:54:12 +00:00
|
|
|
|
if (_data.interestedPlayer.playerLocation.distanceXZ < 3f)
|
2022-03-18 20:49:44 +00:00
|
|
|
|
{
|
2022-04-02 09:54:12 +00:00
|
|
|
|
Vector3 toPositionXZ = _data.interestedPlayer.playerLocation.toPositionXZ;
|
2022-04-07 07:57:51 +00:00
|
|
|
|
_controller.MoveToLocalPosition(_controller.AttachedObject.GetLocalFeetPosition() - toPositionXZ * 3f, MoveType.SEARCH);
|
2022-03-18 20:49:44 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2022-04-02 09:54:12 +00:00
|
|
|
|
|
2022-04-07 07:57:51 +00:00
|
|
|
|
_controller.AttachedObject.StopMoving();
|
2022-03-18 20:49:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Update_Action()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|