CapersProject/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs

82 lines
2.4 KiB
C#
Raw Normal View History

2024-09-12 04:17:34 +00:00
using Sirenix.OdinInspector;
2024-09-09 09:50:37 +00:00
using UnityEngine;
namespace BlueWater.Uis
{
public class TycoonSelectCard : MonoBehaviour
{
2024-09-12 04:17:34 +00:00
[field: SerializeField, CLabel("카드 1")]
2024-09-12 07:38:16 +00:00
private GameObject card01;
2024-09-12 04:17:34 +00:00
[field: SerializeField, CLabel("카드 2")]
2024-09-12 07:38:16 +00:00
private GameObject card02;
2024-09-12 04:17:34 +00:00
[field: SerializeField, CLabel("카드 3")]
2024-09-12 07:38:16 +00:00
private GameObject card03;
2024-09-12 04:17:34 +00:00
2024-09-12 07:38:16 +00:00
private GameObject _currentCard01;
private GameObject _currentCard02;
private GameObject _currentCard03;
2024-09-12 04:17:34 +00:00
2024-09-12 07:38:16 +00:00
private TycoonCard _tycoonCard01Componet;
private TycoonCard _tycoonCard02Componet;
private TycoonCard _tycoonCard03Componet;
2024-09-12 04:17:34 +00:00
[Button("카드 생성하기(레벨업)")]
private void CreateCard()
{
if (!Application.isPlaying) return;
// 기존 카드가 있으면 삭제
2024-09-12 07:38:16 +00:00
if (_currentCard01 != null)
2024-09-12 04:17:34 +00:00
{
2024-09-12 07:38:16 +00:00
Destroy(_currentCard01);
2024-09-12 04:17:34 +00:00
}
2024-09-12 07:38:16 +00:00
if (_currentCard02 != null)
2024-09-12 04:17:34 +00:00
{
2024-09-12 07:38:16 +00:00
Destroy(_currentCard02);
2024-09-12 04:17:34 +00:00
}
2024-09-12 07:38:16 +00:00
if (_currentCard03 != null)
2024-09-12 04:17:34 +00:00
{
2024-09-12 07:38:16 +00:00
Destroy(_currentCard03);
2024-09-12 04:17:34 +00:00
}
2024-09-12 07:38:16 +00:00
_currentCard01 = Instantiate(card01, this.transform);
_currentCard01.name = "Card";
2024-09-12 04:17:34 +00:00
2024-09-12 07:38:16 +00:00
_currentCard02 = Instantiate(card02, this.transform);
_currentCard02.name = "Card02";
2024-09-12 04:17:34 +00:00
2024-09-12 07:38:16 +00:00
_currentCard03 = Instantiate(card03, this.transform);
_currentCard03.name = "Card03";
2024-09-12 04:17:34 +00:00
2024-09-12 07:38:16 +00:00
_currentCard01.transform.localPosition = new Vector3(-550, 0, 0);
_currentCard02.transform.localPosition = new Vector3(0, 0, 0);
_currentCard03.transform.localPosition = new Vector3(550, 0, 0);
2024-09-12 04:17:34 +00:00
2024-09-12 07:38:16 +00:00
_tycoonCard01Componet = _currentCard01.GetComponent<TycoonCard>();
_tycoonCard02Componet = _currentCard02.GetComponent<TycoonCard>();
_tycoonCard03Componet = _currentCard03.GetComponent<TycoonCard>();
2024-09-12 04:17:34 +00:00
2024-09-12 07:38:16 +00:00
_tycoonCard01Componet.Rotation_Start();
_tycoonCard02Componet.Rotation_Start();
_tycoonCard03Componet.Rotation_Start();
2024-09-12 04:17:34 +00:00
}
2024-09-09 09:50:37 +00:00
private void Awake()
{
}
void Start()
{
}
void Update()
{
}
}
}