Пример #1
0
    public void Setup(CardCategory requiredCardCategory, bool isMine)
    {
        this.slotType = requiredCardCategory;

        // setup slot sprite
        if (slotType == CardCategory.Operative)
        {
            GetComponentInChildren <SpriteRenderer>().sprite = operativeSlotSprite;
        }
        else
        {
            GetComponentInChildren <SpriteRenderer>().sprite = policySlotSprite;
        }

        this.isMine = isMine;         // is this a local or enemy operative slot?

        if (animateIn)
        {
            Vector2 scale = transform.localScale;
            transform.localScale = Vector2.zero;
            transform.DOScale(scale, 0.2f);
        }

        mouseTargetable = GetComponent <MouseTargetable>();
        mouseTargetable.SetTargetingGroup(GetEmptyTargetingGroup());
    }
Пример #2
0
    void Start()
    {
        normalColour = spriteRenderer.color;

        mouseTargetable = GetComponent <MouseTargetable>();
        mouseTargetable.OnTGNewlyAddedActions.Add(TurnOnHighlight);
        mouseTargetable.OnTGNewlyRemovedActions.Add(TurnOffHighlight);
        mouseTargetable.Refresh();         // set the highlight going if valid
    }
Пример #3
0
    /// When the enemy draws a card, this client shouldn't know what it is
    public void ConcealedSetup(GameManager gm, int playerNumWhoPlayedThis)
    {
        isConcealed = true;
        FlipFaceDown(false);

        titleText.text       = "Concealed";
        descriptionText.text = "Concealed";

        mouseTargetable = GetComponent <MouseTargetable>();
        mouseTargetable.SetTargetingGroup(TargetingGroup.CardInEnemyHand);

        this.gm       = gm;
        tempPlayerNum = playerNumWhoPlayedThis;
    }
Пример #4
0
    void OnDrop()
    {
        CardSlot cardSlot = GetCollidedCardSlot();

        if (cardSlot != null && cardSlot.CanPlayCardHere(this))
        {
            // reveal this card to both players, then play it to the board
            gm.actionQueue.AddAction(new RevealCardAction(this.actorID, template.ID.GetID()));
            gm.actionQueue.AddAction(new PlayCardAction(this.actorID, cardSlot.actorID));
        }
        else
        {
            ReturnToMyHand();
        }

        MouseTargetable.SetActiveTargetingGroups(new List <TargetingGroup> {
            TargetingGroup.CardInMyHandPlayable,
            TargetingGroup.CardOnBoardChargeable
        });
    }
Пример #5
0
    void OnPickUp()
    {
        // make valid card slots targetable
        TargetingGroup emptyTG = TargetingGroup.NOT_ASSIGNED;

        if (template.cat == CardCategory.Operative)
        {
            emptyTG = TargetingGroup.EmptyMyOperativeSlot;
        }
        else if (template.cat == CardCategory.Policy)
        {
            emptyTG = TargetingGroup.EmptyPolicySlot;
        }

        MouseTargetable.SetActiveTargetingGroups(new List <TargetingGroup> {
            TargetingGroup.DraggedObject,
            emptyTG
        });

        sortingLayerManager.SetSortingLayer("DraggedCard");
    }
Пример #6
0
    void StartTurn()
    {
        if (IsMyTurn())
        {
            MouseTargetable.SetActiveTargetingGroups(new List <TargetingGroup> {
                TargetingGroup.CardInMyHandPlayable,
                TargetingGroup.CardOnBoardChargeable
            });                                                           // make my cards in my hand and the board selectable on my turn
        }
        else
        {
            MouseTargetable.SetActiveTargetingGroups(new List <TargetingGroup> {
            });                                                                                  // make nothing selectable on enemy turn
        }

        RefillFunds();
        DrawCards();
        gm.slotManager.OnStartTurn(IsMyTurn());

        gm.myHand.UpdateAllCardsTargetingGroupsForPlayability();
        gm.slotManager.UpdateAllCardsTargetingGroupsForChargeability();
    }
Пример #7
0
    public void Setup(CardID ID, GameManager gm, int playerNumWhoPlayedThis)
    {
        this.gm = gm;

        template = ID.GetTemplate();
        template.authorPlayer = playerNumWhoPlayedThis;


        // setup visuals
        titleText.text       = template.cardName;
        descriptionText.text = template.description;
        costText.text        = template.playCost.ToString();

        isConcealed = false;

        mouseTargetable = GetComponent <MouseTargetable>();
        mouseTargetable.OnMouseUpAsButtonActions.Add(OnClick);

        mouseDraggable = GetComponent <MouseDraggable>();
        mouseDraggable.OnPickUp.Add(this.OnPickUp);
        mouseDraggable.OnDrop.Add(this.OnDrop);

        UpdateTargetingGroupForPlayability();

        if (template.isChargeable)
        {
            chargeableInterface.SetActive(true);
            SetIsCharged(false);
        }
        else
        {
            chargeableInterface.SetActive(false);
        }

        sortingLayerManager = GetComponent <SortingLayerManager>();
        sortingLayerManager.Setup();
        sortingLayerManager.SetSortingLayer("CardInHand");
    }
Пример #8
0
 void Start()
 {
     mouseTargetable = GetComponent <MouseTargetable>();
     mouseTargetable.OnMouseDownActions.Add(PickUp);
     mouseTargetable.OnMouseUpActions.Add(Drop);
 }