카드효과 추가
This commit is contained in:
parent
9ae0556534
commit
b08c8ef39f
@ -4137,7 +4137,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_persistent: 0
|
||||
_customerDataSo: {fileID: 11400000, guid: e6ce9d58057b580479880585947969d8, type: 2}
|
||||
<CustomerDataSo>k__BackingField: {fileID: 0}
|
||||
_customerPrefab: {fileID: -2302002259734456648, guid: 23195e611c71ad44b8a1ccb2b6e0efe5, type: 3}
|
||||
_customerSpawnTransform: {fileID: 1038321203}
|
||||
_checkEmptySeatInterval: 0.5
|
||||
@ -10827,6 +10827,7 @@ RectTransform:
|
||||
- {fileID: 1909799357}
|
||||
- {fileID: 587277061}
|
||||
- {fileID: 2055805161}
|
||||
- {fileID: 1728221817}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 40.052, y: -1.303, z: -0.86}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@ -18664,22 +18665,11 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_persistent: 0
|
||||
<MaxHeart>k__BackingField: 3
|
||||
CurrentHeart: 0
|
||||
Invincibility: 0
|
||||
<Chracter_Speed>k__BackingField: 1
|
||||
<LiquidA>k__BackingField: 1000
|
||||
<LiquidB>k__BackingField: 1000
|
||||
<LiquidC>k__BackingField: 1000
|
||||
<LiquidD>k__BackingField: 1000
|
||||
<LiquidE>k__BackingField: 1000
|
||||
<GarnishA>k__BackingField: 1000
|
||||
<GarnishB>k__BackingField: 1000
|
||||
<CustomerTableController>k__BackingField: {fileID: 1665075870}
|
||||
<TycoonStageController>k__BackingField: {fileID: 1665075872}
|
||||
_dailyBgm: TycoonDailyBgm1
|
||||
_levelDataSo: {fileID: 11400000, guid: 702b1ed0ce71d1b4aa1ddbce67e475a1, type: 2}
|
||||
_cardDataSo: {fileID: 11400000, guid: 4607b374e49ab734da548949f9e10fed, type: 2}
|
||||
<LevelDataSo>k__BackingField: {fileID: 11400000, guid: 702b1ed0ce71d1b4aa1ddbce67e475a1, type: 2}
|
||||
<CardDataSo>k__BackingField: {fileID: 11400000, guid: 4607b374e49ab734da548949f9e10fed, type: 2}
|
||||
--- !u!114 &1665075870
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -19351,6 +19341,108 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1723000583}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1001 &1728221816
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 1049919592}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 500
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 800
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: -0.00000004371139
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: -180
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7279465393450390489, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Card
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
--- !u!224 &1728221817 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3}
|
||||
m_PrefabInstance: {fileID: 1728221816}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1730879242
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -10,36 +10,6 @@ namespace BlueWater.Tycoons
|
||||
{
|
||||
public class TycoonManager : Singleton<TycoonManager>
|
||||
{
|
||||
|
||||
[field: Title("캐릭터 스테이터스")]
|
||||
[field: SerializeField, CLabel("최대 체력")]
|
||||
public int MaxHeart { get; set; } = 3;
|
||||
|
||||
[field: SerializeField, CLabel("현재 체력")]
|
||||
private int CurrentHeart;
|
||||
[field: SerializeField, CLabel("무적")]
|
||||
public bool Invincibility = false;
|
||||
public int _CurrentHeart { get => CurrentHeart; set { if (!Invincibility) { CurrentHeart = value;}}}
|
||||
|
||||
[field: SerializeField, CLabel("이동 속도")]
|
||||
public float Chracter_Speed { get; set; } = 1.0f;
|
||||
|
||||
[field: Title("음식 스테이터스")]
|
||||
[field: SerializeField, CLabel("Liquid A")]
|
||||
public int LiquidA { get; set; } = 1000;
|
||||
[field: SerializeField, CLabel("Liquid B")]
|
||||
public int LiquidB { get; set; } = 1000;
|
||||
[field: SerializeField, CLabel("Liquid C")]
|
||||
public int LiquidC { get; set; } = 1000;
|
||||
[field: SerializeField, CLabel("Liquid D")]
|
||||
public int LiquidD { get; set; } = 1000;
|
||||
[field: SerializeField, CLabel("Liquid E")]
|
||||
public int LiquidE { get; set; } = 1000;
|
||||
[field: SerializeField, CLabel("Garnish A")]
|
||||
public int GarnishA { get; set; } = 1000;
|
||||
[field: SerializeField, CLabel("Garnish B")]
|
||||
public int GarnishB { get; set; } = 1000;
|
||||
|
||||
[field: Title("컴포넌트")]
|
||||
[field: SerializeField]
|
||||
public CustomerTableController CustomerTableController { get; private set; }
|
||||
@ -80,25 +50,6 @@ namespace BlueWater.Tycoons
|
||||
CustomerTableController = GetComponent<CustomerTableController>();
|
||||
TycoonStageController = GetComponent<TycoonStageController>();
|
||||
}
|
||||
|
||||
|
||||
private Dictionary<string, T> InitializeDictionary<T>(List<T> dataList, Func<T, string> keySelector)
|
||||
{
|
||||
return dataList.ToDictionary(keySelector);
|
||||
}
|
||||
|
||||
public T GetDataByIdx<T>(Dictionary<string, T> dataDictionary, string idx) where T : class
|
||||
{
|
||||
if (dataDictionary.TryGetValue(idx, out var data))
|
||||
return data;
|
||||
|
||||
Debug.LogError($"{idx}와 일치하는 아이템이 없습니다.");
|
||||
return null;
|
||||
}
|
||||
|
||||
public int GetTotalItemCount<T>(Dictionary<string, T> dataDictionary)
|
||||
{
|
||||
return dataDictionary.Count;
|
||||
}
|
||||
}
|
||||
}
|
@ -53,7 +53,6 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
|
||||
[field: SerializeField, CLabel("기울기 복원 속도")]
|
||||
private float returnSpeed = 1.0f;
|
||||
private bool isPointerInside; // 이미지 안에 마우스가 있는지 여부를 추적
|
||||
private Coroutine moveRotationCoroutine;
|
||||
private Coroutine endRotationCoroutine;
|
||||
|
||||
private Image image;
|
||||
@ -63,23 +62,23 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
|
||||
void Start()
|
||||
{
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
_cardData_IDX = TycoonManager.Instance.GetCardDataByIdx(_cardData);
|
||||
_cardData_IDX = TycoonManager.Instance.CardDataSo.GetDataByIdx("HeartPlus");
|
||||
|
||||
Transform nameTransform = transform.Find("Name");
|
||||
Transform nameTransform = transform.Find("Name ");
|
||||
Transform infoTransform = transform.Find("Infomation");
|
||||
|
||||
TextMeshProUGUI nametextComponent = nameTransform.GetComponent<TextMeshProUGUI>();
|
||||
nametextComponent.text = _cardData_IDX.Img;
|
||||
Debug.Log(_cardData_IDX.Img);
|
||||
|
||||
TextMeshProUGUI infotextComponent = infoTransform.GetComponent<TextMeshProUGUI>();
|
||||
infotextComponent.text = _cardData_IDX.ScriptText;
|
||||
Debug.Log(_cardData_IDX.ScriptText);
|
||||
|
||||
image = transform.Find("Image").GetComponent<Image>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Button("회전")]
|
||||
public void Rotation_Start()
|
||||
@ -95,26 +94,8 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
|
||||
|
||||
currentRotationCoroutine = StartCoroutine(RotateOverTime());
|
||||
|
||||
var cardData = TycoonManager.Instance.CardDataSo.GetDataByIdx(_cardData);
|
||||
|
||||
// Resources.Load()
|
||||
}
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
_cardData_IDX = TycoonManager.Instance.CardDataSo.GetDataByIdx(_cardData);
|
||||
|
||||
Transform nameTransform = transform.Find("Name");
|
||||
Transform infoTransform = transform.Find("Infomation");
|
||||
|
||||
TextMeshProUGUI nametextComponent = nameTransform.GetComponent<TextMeshProUGUI>();
|
||||
nametextComponent.text = _cardData_IDX.Img;
|
||||
|
||||
TextMeshProUGUI infotextComponent = infoTransform.GetComponent<TextMeshProUGUI>();
|
||||
infotextComponent.text = _cardData_IDX.ScriptText;
|
||||
|
||||
}
|
||||
|
||||
// 마우스가 이미지 위에 올라갔을 때 호출
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
@ -139,12 +120,6 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
|
||||
endRotationCoroutine = null;
|
||||
}
|
||||
|
||||
if (moveRotationCoroutine != null)
|
||||
{
|
||||
StopCoroutine(moveRotationCoroutine);
|
||||
moveRotationCoroutine = null;
|
||||
}
|
||||
|
||||
endRotationCoroutine = StartCoroutine(ReturnToZeroRotation());
|
||||
|
||||
isPointerInside = false;
|
||||
@ -159,33 +134,15 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
|
||||
public void OnPointerMove(PointerEventData eventData)
|
||||
{
|
||||
|
||||
if (endRotationCoroutine != null)
|
||||
if (isPointerInside)
|
||||
{
|
||||
StopCoroutine(endRotationCoroutine);
|
||||
endRotationCoroutine = null;
|
||||
}
|
||||
|
||||
if (moveRotationCoroutine != null)
|
||||
{
|
||||
StopCoroutine(moveRotationCoroutine);
|
||||
moveRotationCoroutine = null;
|
||||
}
|
||||
|
||||
moveRotationCoroutine = StartCoroutine(SmoothMoveToMouse(eventData));
|
||||
}
|
||||
|
||||
// 마우스의 움직임을 천천히 따라가도록 하는 코루틴
|
||||
private IEnumerator SmoothMoveToMouse(PointerEventData eventData)
|
||||
{
|
||||
while (isPointerInside)
|
||||
{
|
||||
Vector2 localPoint;
|
||||
Vector2 localPoint;
|
||||
|
||||
// 마우스 포인터의 화면 좌표(eventData.position)를 이미지의 로컬 좌표(localPoint)로 변환
|
||||
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, eventData.position, eventData.pressEventCamera, out localPoint))
|
||||
{
|
||||
// 이미지 내에서의 좌표를 정규화된 값으로 변환 (0,0)이 이미지의 왼쪽 아래, (1,1)이 오른쪽 위
|
||||
Vector2 normalizedPoint = new Vector2(
|
||||
Vector2 normalizedPoint = new Vector2(
|
||||
(localPoint.x - rectTransform.rect.xMin) / rectTransform.rect.width,
|
||||
(localPoint.y - rectTransform.rect.yMin) / rectTransform.rect.height
|
||||
);
|
||||
@ -194,21 +151,13 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
|
||||
Vector2 centeredNormalizedPoint = normalizedPoint - new Vector2(0.5f, 0.5f);
|
||||
|
||||
// X와 Y축의 회전 각도를 마우스 위치에 따라 계산 (최대 회전 각도를 15도로 제한)
|
||||
float targetRotationX = Mathf.Clamp(centeredNormalizedPoint.y * maxRotationAngle * 2, -maxRotationAngle, maxRotationAngle);
|
||||
float targetRotationY = Mathf.Clamp(-centeredNormalizedPoint.x * maxRotationAngle * 2, -maxRotationAngle, maxRotationAngle);
|
||||
|
||||
// 현재 회전 값
|
||||
Vector3 currentRotation = rectTransform.localRotation.eulerAngles;
|
||||
|
||||
// 목표 회전 값으로 부드럽게 이동 (Slerp)
|
||||
float rotationX = Mathf.LerpAngle(currentRotation.x, targetRotationX, Time.deltaTime * 1.0f);
|
||||
float rotationY = Mathf.LerpAngle(currentRotation.y, targetRotationY, Time.deltaTime * 1.0f);
|
||||
float rotationX = Mathf.Clamp(centeredNormalizedPoint.y * maxRotationAngle * 2, -maxRotationAngle, maxRotationAngle);
|
||||
float rotationY = Mathf.Clamp(-centeredNormalizedPoint.x * maxRotationAngle * 2, -maxRotationAngle, maxRotationAngle);
|
||||
|
||||
// 회전을 적용 (X축은 위아래 기울기, Y축은 좌우 기울기)
|
||||
rectTransform.localRotation = Quaternion.Euler(rotationX, rotationY, 0f);
|
||||
|
||||
// 천천히 이동하므로 매 프레임마다 기다림
|
||||
yield return null;
|
||||
// Debug.Log($"Mouse Position on Image (relative): ({normalizedPoint.x}, {normalizedPoint.y}), Rotation: ({rotationX}, {rotationY})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user