using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class TurnHandlerDropCard : MonoBehaviour { // ======== serializeField ======== [SerializeField] private RectTransform dropCardPlace; [SerializeField] private Camera mainCamera; [SerializeField] private float cardDropDuration = 0.2f; // ======== private ======== private Vector3 drop_card_point_world_position; private TurnEventManagement turnManager; private void Awake() { turnManager = GetComponent(); } private void Start() { if (mainCamera == null) mainCamera = Camera.main; RectTransformUtility.ScreenPointToWorldPointInRectangle( rect: dropCardPlace, screenPoint: dropCardPlace.position, cam: mainCamera, out drop_card_point_world_position); } private void DropCard() // 系统弃牌 { if (turnManager.GetState() != EVENT_OS_STATE.WAIT) return; // 系统正在处理其他事务 StartCoroutine(coroutine()); return; IEnumerator coroutine() { turnManager.SetState(EVENT_OS_STATE.DROP_RUNNING); if (turnManager.GetHandCardCount() > 0) { for (var i = 0; i < turnManager.GetHandCardCount(); i++) { turnManager.GetHandCard(i).; EventOS.EVENT_TRIGGER(EventData.EVENT_REGISTER_EVENT_ENUM.EVENT_LET_CARD_DROP_SELF, new EventStruct.STRUCT_EVENT_DROP_CARD { ID = i, POSITION = drop_card_point_world_position, DURATION = cardDropDuration, }); yield return new WaitForSeconds(cardDropDuration); } } handCardList.Clear(); // 清空 turnManager.SetState(EVENT_OS_STATE.WAIT); } } }