31 lines
704 B
C#
31 lines
704 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "FishOnMapPreset", menuName = "Scriptable Objects/FishOnMapPreset")]
|
|
public class FishOnMapPreset : ScriptableObject
|
|
{
|
|
[Serializable]
|
|
public class Fish
|
|
{
|
|
public FishData FishData;
|
|
|
|
public Vector2 WeightRange;
|
|
|
|
[Tooltip("x - weight, y - probality curve, must be 0f-1f values")]
|
|
public AnimationCurve WeightCurve;
|
|
|
|
public float GetRandomWeight()
|
|
{
|
|
return Mathf.Lerp(WeightRange.x, WeightRange.y, WeightCurve.Evaluate(UnityEngine.Random.Range(0f, 1f)));
|
|
}
|
|
}
|
|
|
|
public List<Fish> FishList;
|
|
|
|
public Fish GetRandomFish()
|
|
{
|
|
return FishList[UnityEngine.Random.Range(0, FishList.Count)];
|
|
}
|
|
}
|