private void HandleMouse() //Detect Mouse { bool isMouseDown = Input.GetMouseButton(0); CardLogic cardLogic = new CardLogic(); HandleCardDetection(); if (selectedCard == null) { return; } Phase currentPhase = Setting.gameController.CurrentPhase; if (isMouseDown) //Mouse is Pressed { if (mouseState == MouseState.Releasing) { selectedCard.OldPos = selectedCard.transform.position; } else if (mouseState == MouseState.Holding) { HandleMouseClick(selectedCard, currentPhase); // Start holding card } Debug.Log("HoldingCard"); mouseState = MouseState.Holding; } if (!isMouseDown) //Mouse is relased { if (mouseState == MouseState.Holding) // Below codes handle when mouse was holding or clicking something. { bool canDropCard = false; if (!(selectedCard.OriginCard is CreatureCard)) { return; } Card c = selectedCard.OriginCard; canDropCard = DropAfterDrag(currentPhase.GetPhaseId, c); if (canDropCard == false) { cardLogic.ReturnToOldPos(c); //This should work when it failed to defend or drop Debug.Log("Return card"); } } mouseState = MouseState.Releasing; } }