Exemplo n.º 1
0
        public static IEnumerable <Fish> SpawnFish(FishingArea area)
        {
            // Use randomization and time phases in the future
            AnimalInfo chosenInfo = Resources.Load <AnimalInfo>("Fauna Info/Aquatic/Debug Glup Glup");

            for (int i = 0; i < area.Capacity; i++)
            {
                Fish newFish =
                    GameObject.Instantiate(TemplateFish).GetComponent <Fish>();
                newFish.gameObject.name = chosenInfo.name;

                newFish.transform.position = GetRandomPosInArea(area);
                newFish.transform.SetParent(area.FishParent);
                newFish.Init(chosenInfo, area);
                yield return(newFish);
            }
        }
Exemplo n.º 2
0
        public static Vector3 GetRandomPosInArea(FishingArea area)
        {
            Vector3 startPos = new Vector3(
                Random.Range(-area.MaxDistanceFromCenter, area.MaxDistanceFromCenter),
                Random.Range(area.transform.position.y - 3.0f, area.transform.position.y - .5f),
                Random.Range(-area.MaxDistanceFromCenter, area.MaxDistanceFromCenter)
                );

            if (!area.IsInside(startPos))
            {
                return(GetRandomPosInArea(area));
            }
            else
            {
                return(startPos);
            }
        }
Exemplo n.º 3
0
 public void SetContainingArea(FishingArea area)
 {
     _containingArea = area;
 }