50 lines
990 B
C#
50 lines
990 B
C#
using System;
|
|
using UFS2.Gameplay;
|
|
using UFS2.ScriptableObjects;
|
|
|
|
public class FishMultiplayerIdleState : IState
|
|
{
|
|
private FishEntity entity;
|
|
|
|
private MultiplayerFishSpawner.NetworkedFish networkedFish;
|
|
|
|
private FishData _Data => entity.Data;
|
|
|
|
public static event Action<FishEntity> OnEnter;
|
|
|
|
public static event Action<FishEntity> OnExit;
|
|
|
|
public FishMultiplayerIdleState(FishEntity entity)
|
|
{
|
|
this.entity = entity;
|
|
networkedFish = MultiplayerFishSpawner.GetNetworkedFish(entity);
|
|
}
|
|
|
|
public void Enter()
|
|
{
|
|
entity.SetAnimatorFloat("speed", 0f);
|
|
entity.SetAIEnabled(value: true);
|
|
entity.MoveSpeed = 0f;
|
|
entity.ResetBaitRefferences();
|
|
FishMultiplayerIdleState.OnEnter?.Invoke(entity);
|
|
}
|
|
|
|
public void Execute()
|
|
{
|
|
entity.Physics.GravityScaleDown(0.99f);
|
|
if (MultiplayerFishSpawner.IsSlave)
|
|
{
|
|
entity.Target = entity.networkedTarget;
|
|
}
|
|
else
|
|
{
|
|
entity.Target = null;
|
|
}
|
|
}
|
|
|
|
public void Exit()
|
|
{
|
|
FishMultiplayerIdleState.OnExit?.Invoke(entity);
|
|
}
|
|
}
|