void Start() { Collider collider = GetComponent <Collider>(); collider.enabled = false; floater.enabled = false; rigidBody = GetComponent <Rigidbody>(); rigidBody.isKinematic = true; //hingeJoint = this.GetComponent<HingeJoint>(); //connectedBody = hingeJoint.connectedBody; _isFishHooked = false; miniGame = fishingMiniGame.GetComponent <FishingMinigame>(); }
private void OnContact(Collider2D collider) { if (reeling) { //Reeling bobber has returned if (collider.gameObject == source.gameObject) { source.OnReelFinish(null); Destroy(this.gameObject); return; } Fish fish = collider.GetComponent <Fish>(); //Fish wrangled! if (fish && !hitFish) { if (fish.preferredBaitType == baitType || Random.Range(0f, 1f) <= fish.wrongBaitCatchPercent) { FishingMinigame fm = fish.FishingMinigame.GetComponent <FishingMinigame>(); fm.ddr.fishBeingCaught = fish; fm.ddr.targetPlayer = source.player; fm.fish.SetSourceImage(fish.sprite); source.player.movement.enabled = false; source.player.rigidBody.velocity = new Vector3(0, 0, 0); source.OnReelFinish(fish); Destroy(fish.gameObject); Destroy(this.gameObject); return; } else { Debug.Log("No bite"); source.player.stats.baitInventory.removeBait(source.selectedBait); hitFish = true; } } } }