Esempio n. 1
0
    private void MakeBaby()
    {
        GameObject     newDeer = Instantiate(babyPrefab);
        DeerController dc      = newDeer.GetComponent <DeerController>();

        dc.SetBaby();
        GameManager.instance.IncreaseScore();
    }
 private void Throwing()
 {
     if (!isGrabbing)
     {
         return;
     }
     if (!grabCheck)
     {
         return;
     }
     if (Input.GetButtonDown("Grab"))
     {
         isGrabbing = false;
         animator.SetTrigger("yeet");
         grabbedDeer.Release(isInFences);
         grabbedDeer = null;
         grabCheck   = false;
     }
 }
 private void Watering()
 {
     if (isGrabbing)
     {
         return;
     }
     if (Input.GetButtonDown("Water"))
     {
         animator.SetTrigger("water");
         Collider2D[] deers = Physics2D.OverlapCircleAll(grabPoint.position, waterRadius, 1 << LayerMask.NameToLayer("Deers"));
         foreach (Collider2D d in deers)
         {
             DeerController dc = d.GetComponent <DeerController>();
             if (dc != null)
             {
                 dc.Water();
             }
         }
     }
 }
 private void Grabbing()
 {
     if (isGrabbing)
     {
         return;
     }
     if (!grabCheck)
     {
         return;
     }
     if (Input.GetButtonDown("Grab"))
     {
         Collider2D deer = Physics2D.OverlapCircle(grabPoint.position, grabRadius, 1 << LayerMask.NameToLayer("Deers"));
         if (deer == null)
         {
             return;
         }
         grabbedDeer = deer.GetComponent <DeerController>();
         grabbedDeer.Grab(grabPoint);
         isGrabbing = true;
         animator.SetTrigger("grab");
         grabCheck = false;
     }
 }