using System; using System.Collections.Generic; using UFS2.ScriptableObjects; using UnityEngine; namespace ShiningGames.UFS2 { [Serializable] public class FishTargetArea { public List OverallPoints; public List BottomPoints; public List SurfacePoints; public Collider[] Volumes; public FishTarget GetRandomTarget(FishBehaviourType fishBehaviourType) { FishTarget fishTarget = null; fishTarget = fishBehaviourType switch { FishBehaviourType.PassivePredator => (UnityEngine.Random.value > 0.5f) ? GetRandomPoint(OverallPoints) : GetRandomPoint(BottomPoints), FishBehaviourType.Deep => GetRandomPoint(BottomPoints), _ => GetRandomPoint(OverallPoints), }; if (fishTarget == null) { fishTarget = GetRandomPoint(OverallPoints); } if (fishTarget == null) { fishTarget = GetRandomPoint(BottomPoints); } if (fishTarget == null) { fishTarget = GetRandomPoint(SurfacePoints); } return fishTarget; static FishTarget GetRandomPoint(List points) { if (points == null || points.Count <= 0) { return null; } return points[UnityEngine.Random.Range(0, points.Count)]; } } } }