Ejemplo n.º 1
0
    /// <summary>
    /// Triggers the behaviour to reach the feed location
    /// </summary>
    /// <param name="feed">The feed in range</param>
    private void FeedSpoted(Pienso feed)
    {
        feedSpoted?.Invoke(gameObject, new EventArgs());

        mFeed          = feed;
        isFeed         = true;
        location       = feed.Location;
        nextTimeMoving = 0;

        GetComponent <Rigidbody2D>().isKinematic = false;
    }
Ejemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag.Equals("Feed"))
     {
         feedReached = true;
         animator.SetBool("Eat", true);
         GetComponent <Rigidbody2D>().velocity = Vector2.zero;
         nFeedsNear++;
     }
     else
     {
         Pienso feed = other.gameObject.GetComponent <Pienso>();
         if (feed != null)
         {
             FeedSpoted(feed);
         }
     }
 }