Esempio n. 1
0
 private void LandedInNewTree()
 {
     birdState = BirdState.Idle;
     animator.SetInteger("birdState", (int)birdState);
     currentLandingSpot   = targetLandingSpot;
     startTransform       = currentLandingSpot.transform;
     lineRenderer.enabled = false;
     spottedCoolDown      = true;
     StartCoroutine(CountDownResetSpotted());
 }
Esempio n. 2
0
 public BirdLandingSpot GetNewLandingSpot()
 {
     for (int i = 0; i < UnoccupiedSpots.Count; i++)
     {
         if (!UnoccupiedSpots[i].inFrustum)
         {
             BirdLandingSpot toReturn = UnoccupiedSpots[i];
             UnoccupiedSpots.Remove(UnoccupiedSpots[i]);
             return(toReturn);
         }
     }
     return(null);
 }
Esempio n. 3
0
 public BirdLandingSpot GetNewLandingSpot(TreeType desiredTreeType)
 {
     for (int i = 0; i < UnoccupiedSpots.Count; i++)
     {
         if (UnoccupiedSpots[i].GetTreeType() == desiredTreeType && !UnoccupiedSpots[i].inFrustum)
         {
             BirdLandingSpot toReturn = UnoccupiedSpots[i];
             UnoccupiedSpots.Remove(UnoccupiedSpots[i]);
             return(toReturn);
         }
     }
     return(null);
 }
Esempio n. 4
0
    public void FlyToNextSpot()
    {
        switch (treePreference)
        {
        case TreePreference.Leaf:
            targetLandingSpot = birdManager.GetNewLandingSpot(TreeType.Leaves);
            break;

        case TreePreference.Any:
            targetLandingSpot = birdManager.GetNewLandingSpot();
            break;

        default:
            break;
        }

        if (targetLandingSpot)
        {
            birdManager.LeaveLandingSpot(currentLandingSpot);

            finishTransform = targetLandingSpot.transform;
            DrawFlightPath();
            birdState = BirdState.Flying;
            animator.SetInteger("birdState", (int)birdState);

            StartCoroutine(ILerpRotation());
            StartCoroutine(ILerpPosition());
        }
        else
        {
            birdState = BirdState.Idle;
            animator.SetInteger("birdState", (int)birdState);
            spottedCoolDown = true;
            StartCoroutine(CountDownResetSpotted());
        }
    }
Esempio n. 5
0
 public void LeaveLandingSpot(BirdLandingSpot spot)
 {
     UnoccupiedSpots.Add(spot);
 }