public override void Update() { fish.animator.SetBool("Swim", true); GameObject decoy = null; Collider2D decoyCollider = Physics2DUtils.GetColliderAround(fish.transform, fish.fishData.rangeToSeeDecoy, "Decoy"); if (decoyCollider != null) { decoy = decoyCollider.gameObject; seeTheDecoy = true; } else { seeTheDecoy = false; } if (decoy != null && decoy.transform.position.y < 0 && decoy.GetComponent <FishingRode>().fish == null && canBeCatch) { if (Vector2.Distance(fish.transform.position, decoy.transform.position) <= fish.fishData.rangeToPickDecoy) { GrabDecoy(decoy); } else if (Vector2.Distance(fish.transform.position, decoy.transform.position) <= fish.fishData.rangeToSlowNearDecoy) { GoAndLook(decoy.transform.position, 0.3f); } else { GoAndLook(decoy.transform.position, 1); } } else { MoveRandomly(); } }
public override void Update() { base.Update(); if (Physics2DUtils.GetColliderAround(transform, radiusToGoInBoat, "Player") != null) { Player.instance.boat = this; } }
public override void Update() { if (Physics2DUtils.CheckIfColliderAround(player.transform, 2, "Decoy") && canCheckDecoyAround) { Physics2DUtils.GetColliderAround(player.transform, 3, "Decoy").GetComponent <FishingRode>().GetBackFish(); player.animator.SetBool("Fishing", false); player.animator.SetBool("ThrowFishingRode", false); } }
public override void DoInteraction() { if (Player.instance.GetStateLocation() is PlayerInBoat && Physics2DUtils.CheckIfColliderAround(transform, 5, "Ground")) { Player.instance.GoOutOfBoat(Physics2DUtils.GetColliderAround(transform, 5, "Ground").GetComponent <Ground>()); } else { Player.instance.GoInBoat(); } }
public override void ShowText() { base.ShowText(); if (Physics2DUtils.GetColliderAround(transform, 5, "Ground") != null && Player.instance.GetStateLocation() is PlayerInBoat) { textZone.text = "Out of boat"; showInteractObject.SetActive(true); } else { textZone.text = description; showInteractObject.SetActive(true); } }
public virtual void CheckPlayerAround() { if (Physics2DUtils.GetColliderAround(transformRightToCheckAround, radiusToCheckPlayer, "Player") != null || Physics2DUtils.GetColliderAround(transformLeftToCheckAround, radiusToCheckPlayer, "Player") != null) { if (ConditionShowText()) { ShowText(); } else { HideText(); } } else { HideText(); } }
public virtual void Update() { if (Player.instance != null) { if (Physics2DUtils.GetColliderAround(transformRightToCheckAround, radiusToCheckPlayer, "Player") != null || Physics2DUtils.GetColliderAround(transformLeftToCheckAround, radiusToCheckPlayer, "Player") != null) { if (!Player.instance.interactableObjectNearList.Contains(this)) { Player.instance.interactableObjectNearList.Add(this); } } else { if (Player.instance.interactableObjectNearList.Contains(this)) { Player.instance.interactableObjectNearList.Remove(this); } } } CheckPlayerAround() /*CheckHideText(transformRightToCheckAround, transformLeftToCheckAround)*/; }