public void FishingEnd(bool success) { foreach (Fish f in Fishes) { f.FishingEnd(); } areaCollider.enabled = true; FishingControls?.Disable(); FishingControls?.Dispose(); FishingControls = null; Debug.Log("Stopped fishing."); if (_fishingBehaviourScript == null) { return; } if (success) { ActiveFish.ForceStopAI(); Debug.Log("Fish Caught!"); } else { OnFail?.Invoke(); Debug.Log("Fish Got Away..."); } Destroy(_fishingBehaviourScript.gameObject); }
public void FishingStart(Floater bait, Action onFail) { if (_fishingBehaviourScript != null) { return; } Debug.Log("Started Fishing!"); OnFail = onFail; areaCollider.enabled = false; FloaterScript = bait; BaitTransform = bait.transform; FishingControls = new FishingControls(); FishingControls.Rod.Reel.performed += WiggleCallback; FishingControls.Enable(); ActiveFish = null; foreach (Fish f in Fishes) { f.FishingStart(); } }
private void Awake() { _controls = new FishingControls(); _controls.Rod.Throw.performed += ctx => OnButtonPress(); _controls.Rod.Throw.canceled += ctx => { OnButtonRelease(); Debug.Log(Casted); if (!Casted) { Casted = ValidatePoint(); } else { Casted = !Casted; } }; _checkMask = LayerMask.GetMask(FishingArea.FISHING_LAYER); Casted = false; }
private void OnDisable() { FishingControls?.Disable(); }
private void OnEnable() { FishingControls?.Enable(); }