Пример #1
0
 private void OnMouseDown()
 {
     if (BoardBehaviour.IsCurrentPlayerAction())
     {
         NetworkController.Instance.PlayerEndTurn();
     }
 }
Пример #2
0
    public override void OnEndDrag()
    {
        DisableAllGlow();

        // find cardslot when end drag
        GameObject endSlot = null;

        RaycastHit[] hits = Physics.RaycastAll(origin: new Vector3(transform.position.x, transform.position.y, -10), direction: new Vector3(0, 0, 1), maxDistance: 30f);
        foreach (RaycastHit h in hits)
        {
            if (h.transform.tag == "CardSlot")
            {
                endSlot = h.transform.gameObject;
            }
        }
        CardObjectBehaviour cob = gameObject.GetComponent <CardObjectBehaviour>();

        if (endSlot != null && BoardBehaviour.IsCurrentPlayerAction())
        {
            //Dragged into a cardslot
            CardSlotBehaviour csb = endSlot.GetComponent <CardSlotBehaviour>();
            NetworkController.Instance.PlayerPlayCardToSlot(cob.Owner.PlayerName, cob.Guid, csb.SlotId);

            // Move card to neutral position and play effects
            Vector3 spellEffectPos = BoardBehaviour.NeutralBattlePoint.transform.position;
            gameObject.transform.DOMove(new Vector3(spellEffectPos.x, spellEffectPos.y, -3f), GameConfig.F("SPELL_CARD_FLY_TIME"));
            gameObject.transform.DOScale(GameConfig.F("SPELL_CARD_SCALE"), GameConfig.F("SPELL_CARD_FLY_TIME"));
            //  - Add effect to the card
            cob.AddEffectParticle();
        }
        else
        {
            // Dragged into somewhere else
            transform.DOMove(cob.OriginPos, 0.5f).SetEase(Ease.OutCubic);
        }
    }
Пример #3
0
 private void OnMouseDown()
 {
     if (BoardBehaviour.GetUIState() != UIState.TARGETING && BoardBehaviour.GetUIState() != UIState.SLOT_TARGETING && BoardBehaviour.IsCurrentPlayerAction())
     {
         NetworkController.Instance.PlayerAttackWithSlot(BoardBehaviour.LocalPlayerName,SlotId,SlotId);
     }
     if (BoardBehaviour.GetUIState() == UIState.SLOT_TARGETING)
     {
         NetworkController.Instance.SelectSlotEmit(BoardBehaviour.LocalPlayerName,Pob.PlayerName,SlotId);
         BoardBehaviour.SetUIState(UIState.ACTION);
     }
 }