Files
Fishing2/Assets/Scripts/Configs~/Mem/BaitConfig.cs
2025-10-10 17:57:36 +08:00

137 lines
4.8 KiB
C#

using System;
using System.Linq;
using UnityEngine;
namespace NBF
{
[TableName("gameBaits")]
public partial class BaitConfig : ConfigGearBase
{
public enum Type
{
Natural = 0,
Spinning = 1
}
public Type type;
public FishSpecies[] acceptFish;
public Vector2 weightFishAccept = new Vector2(0f, 3f);
public float weight = 10f;
public float lenght;
public int amount = 1;
public int Level = 1;
private Vector2 startedbaitValues;
public virtual bool CheckIsFishAccept(FishSpecies fishSpecies, float fishWeight = 0f)
{
var fish = FishConfig.Get(t => t.speciesName == fishSpecies);
if (fish == null) return false;
if (fish.type == FishConfig.Type.Predator && type == Type.Spinning)
{
Vector2 vector = weightFishAccept;
Debug.Log("Startowa wartosc przynety:" + vector.ToString());
vector = startedbaitValues;
Debug.Log("Kolejna wartosc przynety 1:" + vector.ToString());
Vector2 vector2 = new Vector2(0f, 0f);
if (startedbaitValues == vector2)
{
if (weightFishAccept.x > 0.01f && weightFishAccept.x <= 2.5f)
{
weightFishAccept.x = 0.01f;
}
else if (weightFishAccept.x > 2.5f && weightFishAccept.x <= 9.2f)
{
weightFishAccept.x = 2.5f;
}
else if (weightFishAccept.x > 9.2f && weightFishAccept.x <= 20f)
{
weightFishAccept.x = 8f;
}
else if (weightFishAccept.x > 20f && weightFishAccept.x <= 50f)
{
weightFishAccept.x = 14f;
}
else if (weightFishAccept.x > 50f && weightFishAccept.x <= 700f)
{
weightFishAccept.x = 22f;
}
else if (weightFishAccept.x > 700f)
{
weightFishAccept.x = 150f;
}
if (weightFishAccept.y > 0.1f && weightFishAccept.y <= 3f)
{
weightFishAccept.y = 3f;
}
else if (weightFishAccept.y > 3f && weightFishAccept.y <= 9f)
{
weightFishAccept.y = 12f;
}
else if (weightFishAccept.y > 9f && weightFishAccept.y <= 24f)
{
weightFishAccept.y = 60f;
}
else if (weightFishAccept.y > 24f && weightFishAccept.y <= 50f)
{
weightFishAccept.y = 120f;
}
else if (weightFishAccept.y > 50f && weightFishAccept.y <= 105f)
{
weightFishAccept.y = 350f;
}
else if (weightFishAccept.y > 105f && weightFishAccept.y <= 170f)
{
weightFishAccept.y = 650f;
}
else if (weightFishAccept.y > 170f && weightFishAccept.y <= 500f)
{
weightFishAccept.y = 900f;
}
else if (weightFishAccept.y > 500f)
{
weightFishAccept.y = 1800f;
}
startedbaitValues = weightFishAccept;
vector = startedbaitValues;
Debug.Log("Kolejna wartosc przynety: 2" + vector.ToString());
}
if (fishWeight >= weightFishAccept.x && fishWeight <= weightFishAccept.y)
{
vector = weightFishAccept;
Debug.Log("Fish accept lure: " + vector.ToString() + " weight:" + fishWeight);
return true;
}
}
else if (fish.type == FishConfig.Type.WhiteFish && type == Type.Natural)
{
if (acceptFish.Contains(fishSpecies))
{
Debug.Log("Fish accept bait weight:" + fishWeight);
return true;
}
}
else if (fish.type == FishConfig.Type.Predator && type == Type.Natural &&
acceptFish.Contains(fishSpecies))
{
Debug.Log("Fish accept bait predator weight:" + fishWeight);
return true;
}
return false;
}
}
}