Ejemplo n.º 1
0
    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();
        }
    }
Ejemplo n.º 2
0
 public override void Update()
 {
     base.Update();
     if (Physics2DUtils.GetColliderAround(transform, radiusToGoInBoat, "Player") != null)
     {
         Player.instance.boat = this;
     }
 }
Ejemplo n.º 3
0
    //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);
    }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
 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();
     }
 }
Ejemplo n.º 6
0
 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");
     }
 }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
0
 public virtual void CheckPlayerAround()
 {
     if (Physics2DUtils.GetColliderAround(transformRightToCheckAround, radiusToCheckPlayer, "Player") != null || Physics2DUtils.GetColliderAround(transformLeftToCheckAround, radiusToCheckPlayer, "Player") != null)
     {
         if (ConditionShowText())
         {
             ShowText();
         }
         else
         {
             HideText();
         }
     }
     else
     {
         HideText();
     }
 }
Ejemplo n.º 9
0
 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)*/;
 }