92 lines
3.6 KiB
C#
92 lines
3.6 KiB
C#
using RootMotion.FinalIK;
|
|
using UnityEngine;
|
|
|
|
public class TrophyPanel : MonoBehaviour
|
|
{
|
|
public Transform fishPanelConatiner;
|
|
|
|
public GameManager.FishSpecies fishSpecies;
|
|
|
|
public float fishWeight;
|
|
|
|
public TextMesh textmeshInfo;
|
|
|
|
private void Start()
|
|
{
|
|
Invoke("ShowFish", 0.2f);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
private void ShowFish()
|
|
{
|
|
for (int i = 0; i < Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerTrophy.Count; i++)
|
|
{
|
|
if (Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerTrophy[i].fishSpecies == fishSpecies)
|
|
{
|
|
fishWeight = Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerTrophy[i].fishWeight;
|
|
GameObject gameObject = null;
|
|
gameObject = ((GameManager.Instance.gameFish[(int)fishSpecies].modelTrophyPath.Length != 0) ? Object.Instantiate(GameManager.Instance.gameFish[(int)fishSpecies].GetTrophyModelPrefab(fishWeight), fishPanelConatiner) : Object.Instantiate(GameManager.Instance.gameFish[(int)fishSpecies].GetFishModel(fishWeight), fishPanelConatiner));
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
gameObject.transform.localScale = GameManager.Instance.gameFish[(int)fishSpecies].GetFishScale(fishWeight);
|
|
if (gameObject.GetComponent<FFish>() != null)
|
|
{
|
|
_ = gameObject.GetComponent<FFish>().m_Renderer;
|
|
Object.Destroy(gameObject.GetComponent<FFish>());
|
|
Object.Destroy(gameObject.GetComponent<FFishRagDoll>());
|
|
Object.Destroy(gameObject.GetComponent<Rigidbody>());
|
|
Object.Destroy(gameObject.GetComponent<CCDIK>());
|
|
Object.Destroy(gameObject.GetComponent<Animator>());
|
|
gameObject.transform.localEulerAngles = new Vector3(0f, -90f, 0f);
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
gameObject.transform.localEulerAngles = Vector3.zero;
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
}
|
|
textmeshInfo.gameObject.SetActive(value: true);
|
|
textmeshInfo.text = GameManager.Instance.gameFish[(int)fishSpecies].GetFishName() + "\n" + GameManager.Instance.ConvertWeight(fishWeight);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ShowFishTest(bool maxWeight = false)
|
|
{
|
|
if (maxWeight)
|
|
{
|
|
fishWeight = 10000f;
|
|
}
|
|
GameObject gameObject = null;
|
|
gameObject = ((GameManager.Instance.gameFish[(int)fishSpecies].modelTrophyPath.Length != 0) ? Object.Instantiate(GameManager.Instance.gameFish[(int)fishSpecies].GetTrophyModelPrefab(fishWeight), fishPanelConatiner) : Object.Instantiate(GameManager.Instance.gameFish[(int)fishSpecies].GetFishModel(fishWeight), fishPanelConatiner));
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
gameObject.transform.localScale = GameManager.Instance.gameFish[(int)fishSpecies].GetFishScale(fishWeight);
|
|
if (gameObject.GetComponent<FFish>() != null)
|
|
{
|
|
_ = gameObject.GetComponent<FFish>().m_Renderer;
|
|
Object.Destroy(gameObject.GetComponent<FFish>());
|
|
Object.Destroy(gameObject.GetComponent<FFishRagDoll>());
|
|
Object.Destroy(gameObject.GetComponent<Rigidbody>());
|
|
Object.Destroy(gameObject.GetComponent<CCDIK>());
|
|
Object.Destroy(gameObject.GetComponent<Animator>());
|
|
gameObject.transform.localEulerAngles = new Vector3(0f, -90f, 0f);
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
gameObject.transform.localEulerAngles = Vector3.zero;
|
|
gameObject.transform.localPosition = Vector3.zero;
|
|
}
|
|
textmeshInfo.gameObject.SetActive(value: true);
|
|
textmeshInfo.text = GameManager.Instance.gameFish[(int)fishSpecies].GetFishName() + "\n" + GameManager.Instance.ConvertWeight(fishWeight);
|
|
}
|
|
|
|
public void ReShowFish()
|
|
{
|
|
GameManager.TruncateContainer(fishPanelConatiner);
|
|
ShowFish();
|
|
}
|
|
}
|