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 CheckHideText(Transform transformRightToCheckAround, Transform transformLeftToCheckAround) //{ // if(Player.instance.GetStateLocation() is PlayerInBoat && !(Player.instance.GetStateAction() is PlayerExplore)) // { // if (Physics2DUtils.GetColliderAround(transformRightToCheckAround, 5, "Ground") == null || Physics2DUtils.GetColliderAround(transformLeftToCheckAround, 5, "Ground") == null) // { // showInteractObject.SetActive(false); // } // } // else if (!(Player.instance.GetStateAction() is PlayerExplore)) // { // if (Physics2DUtils.GetColliderAround(transformRightToCheckAround, 5, "Player") == null || Physics2DUtils.GetColliderAround(transformLeftToCheckAround, 5, "Player") == null) // { // showInteractObject.SetActive(false); // } // } //} public override bool ConditionShowText() { if (Player.instance.GetStateAction() is PlayerExplore && ((Player.instance.GetStateLocation() is PlayerInBoat && Physics2DUtils.CheckIfColliderAround(transform, 5, "Ground")) || Player.instance.GetStateLocation() is PlayerOnGround)) { return(true); } return(false); }
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 PressForFishing() { if (Physics2DUtils.CheckIfColliderAround(player.transform, 3, "Water")) { StartFishing(); player.animator.SetBool("ThrowFishingRode", true); } else { Debug.Log("Vous ĂȘtes trop loin de l'eau"); } }
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)*/; }