Exemplo n.º 1
0
    // gives player a new card from a given position
    public void GivePlayerACard(CardAsset c, int index, bool canSee)
    {
        GameObject card;

        card = CreateACardAtPosition(c, DeckTransform.position, new Vector3(0f, -179f, 0f));

        // pass this card to HandVisual class
        AddCard(card, index);

        // Bring card to front while it travels from draw spot to hand
        WhereIsTheCardOrMonster w = card.GetComponent <WhereIsTheCardOrMonster>();

        w.BringToFront();
        w.Slot = index;

        // move card to the hand;
        Sequence s = DOTween.Sequence();

        // displace the card so that we can select it in the scene easier.
        s.Append(card.transform.DOLocalMove(slots.Children[0].transform.localPosition, GameStateSync.Instance.CardTransitionTime));

        if (canSee)
        {
            //s.Append(card.transform.DOMove(DrawPreviewSpot.position, GameStateSync.Instance.CardTransitionTime));
            s.Insert(0f, card.transform.DORotate(Vector3.zero, GameStateSync.Instance.CardTransitionTime));
            //s.AppendInterval(GameStateSync.Instance.CardPreviewTime);
        }
        else
        {
            HoverPreview preview = card.GetComponent <HoverPreview>();
            Destroy(preview);
        }

        s.OnComplete(() => ChangeLastCardStatusToInHand(card, w));
    }
Exemplo n.º 2
0
    public override void OnStartDrag()
    {
        savedHandSlot           = whereIsCard.Slot;
        tempState               = whereIsCard.VisualState;
        whereIsCard.VisualState = VisualStates.Dragging;
        whereIsCard.BringToFront();

        PlayerArea area = GameStateSync.Instance.playerArea;

        if (GameStateSync.Instance.gameView.phase.Equals(GameStateSync.GUTS_PHASE))
        {
            area.monsterVisual.HighlightMonster(area.highlightColor, 3, true);
        }
        else if (GameStateSync.Instance.gameView.phase.Equals(GameStateSync.ATTACK_PHASE) ||
                 GameStateSync.Instance.gameView.phase.Equals(GameStateSync.DEFEND_PHASE))
        {
            foreach (PlayableCard playableCard in GameStateSync.Instance.playableCardView.playableCards)
            {
                if (playableCard.cardIndex == savedHandSlot)
                {
                    for (int i = 0; i < playableCard.users.Count; i++)
                    {
                        // find targets
                        area.monsterVisual.HighlightMonster(area.highlightColor, playableCard.users[i], true);
                        GameStateSync.Instance.targets = playableCard.targets;
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
    // flips a player's monster card
    public void PlayMonster(MonsterAsset monsterAsset, int index)
    {
        GameObject monster;

        monster = CreateAMonsterAtPosition(monsterAsset, slots.Children[index].position, new Vector3(0f, -179f, 0f));
        MonsterManager monsterManager = monster.GetComponent <MonsterManager>();

        monsterManager.index = index;
        monsterManager.CardFaceGlowImage.enabled = false;
        monsterManagers.Insert(index, monsterManager);

        // pass this monster to HandVisual class
        AddMonster(monster, index);

        // bring monster to front
        WhereIsTheCardOrMonster w = monster.GetComponent <WhereIsTheCardOrMonster>();

        w.BringToFront();
        w.Slot = index;

        // flip monster
        Sequence s = DOTween.Sequence();

        s.Insert(0f, monster.transform.DORotate(Vector3.zero, GameStateSync.Instance.MonsterFlipTime));

        // displace the monster so that we can select it in the scene easier.
        s.Append(monster.transform.DOLocalMove(slots.Children[0].transform.localPosition, GameStateSync.Instance.MonsterFlipTime));

        s.OnComplete(() => ChangeLastCardStatusToInHand(monster, w));
    }