首次提交
This commit is contained in:
57
Assets/Scripts/Fishing~/Player/Gear/FFeeder.cs
Normal file
57
Assets/Scripts/Fishing~/Player/Gear/FFeeder.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using NBF;
|
||||
using UnityEngine;
|
||||
|
||||
public class FFeeder : FPlayerGear
|
||||
{
|
||||
[HideInInspector]
|
||||
public Rigidbody rigidbody;
|
||||
|
||||
[HideInInspector]
|
||||
public FWaterDisplacement waterDisplacement;
|
||||
|
||||
public ParticleSystem smuuggeParticle;
|
||||
|
||||
[HideInInspector]
|
||||
public FRod currentRod;
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
rigidbody = GetComponent<Rigidbody>();
|
||||
waterDisplacement = GetComponent<FWaterDisplacement>();
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
ShowWaterFX();
|
||||
if ((bool)currentRod)
|
||||
{
|
||||
if ((bool)currentRod.currentFish)
|
||||
{
|
||||
waterDisplacement.isFreeze = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
waterDisplacement.isFreeze = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowWaterFX()
|
||||
{
|
||||
if (smuuggeParticle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (waterDisplacement.waterHeightPosition - 0.1f <= transform.position.y && waterDisplacement.waterHeightPosition + 0.1f > transform.position.y)
|
||||
{
|
||||
if (!smuuggeParticle.isEmitting)
|
||||
{
|
||||
smuuggeParticle.Play();
|
||||
}
|
||||
}
|
||||
else if (smuuggeParticle.isPlaying)
|
||||
{
|
||||
smuuggeParticle.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user