예제 #1
0
        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);
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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;
        }
예제 #4
0
 private void OnDisable()
 {
     FishingControls?.Disable();
 }
예제 #5
0
 private void OnEnable()
 {
     FishingControls?.Enable();
 }