35 lines
654 B
C#
35 lines
654 B
C#
using BitStrap;
|
|
using UnityEngine;
|
|
|
|
public class FishingNetTrigger : MonoBehaviour
|
|
{
|
|
[ReadOnly]
|
|
public FishingNet fishingNet;
|
|
|
|
[ReadOnly]
|
|
public MeshCollider meshCollider;
|
|
|
|
public void Awake()
|
|
{
|
|
meshCollider = GetComponent<MeshCollider>();
|
|
fishingNet = GetComponentInParent<FishingNet>();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
meshCollider.gameObject.layer = LayerMask.NameToLayer("Default");
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider col)
|
|
{
|
|
if (col.gameObject.HasTag("FISH"))
|
|
{
|
|
Fish component = col.gameObject.GetComponent<Fish>();
|
|
if ((bool)component && (bool)component.storedBait)
|
|
{
|
|
fishingNet.FishCatch(component);
|
|
}
|
|
}
|
|
}
|
|
}
|