Ejemplo n.º 1
0
        private void PlayerBuyCard()
        {
            SoundEngine.Instance.PlaySoundEffect("coin", 0.4f);

            // Create card animation from hand zone to play zone
            uint totalFrame = 40;
            Vector2 position = new Vector2(this.game.DISCARD_POSITION.X + 3, this.game.DISCARD_POSITION.Y + 3);
            CardAnimation anim = new CardAnimation(this.CardList[mouse_hover_index],
                                     this.getHandCardPosition(mouse_hover_index),
                                     position,
                                     totalFrame,
                                     1.0f,
                                     1.0f,
                                     this.cardRotation,
                                     this.cardRotation,
                                     true,
                                     Color.Black,
                                     "cardPlace1");
            this.game.AnimationList.Add(anim);
            anim.RegisterCallback(MainPlayerBuyCard, this.CardList[mouse_hover_index]);
            this.game.AnimationList.Add(anim);

            // Restock card
            CardList[mouse_hover_index] = this.game.RandomlyGenerateCard();
        }
Ejemplo n.º 2
0
        public override void Update()
        {
            base.Update();
            // Right mouse click: Show CardSelectedOverlay
            if (mouse_hover_index != -1 && mouse_hover_index < this.cardDisplaySize)
            {
                // Left mouse click: Play card
                if (game.controller.isLeftMouseButtonClicked())
                {
                    if (this.mainPlayer.ActionPoint > 0)
                    {
                        CardAnimation anim;
                        uint totalFrame = 20;

                        // Create card animation from hand zone to play zone
                        int playZoneIndex = Math.Min(this.game.PlayZone.CardList.Count, 4);
                        anim = new CardAnimation(this.mainPlayer.Hand[mouse_hover_index],
                                                 this.getHandCardPosition(mouse_hover_index),
                                                 this.game.PlayZone.getHandCardPosition(playZoneIndex),
                                                 totalFrame,
                                                 1.0f,
                                                 1.0f,
                                                 GameInstance.CARD_ROTATION,
                                                 GameInstance.CARD_ROTATION,
                                                 true,
                                                 Color.Black,
                                                 "cardSlide3");
                        anim.RegisterCallback(this.game.PlayZone.IncrementDisplaySize);
                        this.game.AnimationList.Add(anim);

                        // Play Card
                        this.mainPlayer.PlayCard(this.mainPlayer.Hand[mouse_hover_index]);
                    }
                    else
                    {
                        SoundEngine.Instance.PlaySoundEffect("error");
                    }
                }
            }
        }