コード例 #1
0
    public override void OnMouseDown()
    {
        //Enlarge for easy viewing
        if (!isCasting)
        {
            //Sort UI layering
            transform.SetParent(CanvasController.canvasController.selectedCardCanvas.transform);
            cardDisplay.cardName.sortingOrder = 3;

            transform.localScale = new Vector2(HandController.handController.cardHighlightSize, HandController.handController.cardHighlightSize);
            float x = Mathf.Clamp(Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)).x, -HandController.handController.cardHighlightXBoarder, HandController.handController.cardHighlightXBoarder);
            float y = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)).y + HandController.handController.cardHighlightHeight;
            transform.position = new Vector2(x, y);
            transform.SetAsLastSibling();
        }
        cardController.CreateRangeIndicator();

        if (cardController.GetNetManaCost() > 0)
        {
            UIController.ui.SetAnticipatedManaLoss(cardController.GetNetManaCost());
        }
        if (cardController.GetNetEnergyCost() > 0)
        {
            UIController.ui.SetAnticipatedManaGain(cardController.GetNetEnergyCost());
        }

        base.OnMouseDown();
    }
コード例 #2
0
    public override void OnMouseDown()
    {
        //Enlarge for easy viewing
        if (!isCasting)
        {
            transform.localScale = new Vector2(HandController.handController.cardHighlightSize, HandController.handController.cardHighlightSize);
            transform.position   = new Vector2(Mathf.Clamp(transform.position.x, -HandController.handController.cardHighlightXBoarder, HandController.handController.cardHighlightXBoarder), HandController.handController.cardHighlightHeight);
            transform.SetAsLastSibling();
        }
        cardController.CreateRangeIndicator();

        //Allow click only if there is enough mana left over
        if (TurnController.turnController.HasEnoughMana(cardController.GetCard().manaCost))
        {
            base.OnMouseDown();
        }
        else
        {
        }
    }