private void LandedInNewTree() { birdState = BirdState.Idle; animator.SetInteger("birdState", (int)birdState); currentLandingSpot = targetLandingSpot; startTransform = currentLandingSpot.transform; lineRenderer.enabled = false; spottedCoolDown = true; StartCoroutine(CountDownResetSpotted()); }
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); }
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); }
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()); } }
public void LeaveLandingSpot(BirdLandingSpot spot) { UnoccupiedSpots.Add(spot); }