Example #1
0
        /// <summary>
        /// Add the transform of card to hand.
        /// Adjust the position of all hand cards.
        /// </summary>
        /// <param name="go"></param>
        public override void Add(UICard card)
        {
            Assert.IsTrue(Hands.Count < MAXSIZE);

            //UICard card = go.GetComponent<UICard>();
            GameObject go = card.gameObject;

            Hands.Add(card);
            int firstInd = GetFirstCardIndex();

            if (count % 2 == 1)
            {
                MultiAnimation moves = new MultiAnimation();
                for (int i = 0; i < count; ++i)
                {
                    Transform   targetPos = CardPos[firstInd + i];
                    LSAnimation move      = AnimationFactory.Instance.CreatMove(Hands[i].gameObject, targetPos);
                    go.transform.SetParent(transform);
                    moves.Add(move);
                }
                AnimationManager.Instance.AddAnimation(moves);
            }
            Transform   targetPos2 = CardPos[firstInd + count - 1];
            LSAnimation move2      = AnimationFactory.Instance.CreatMove(go, targetPos2);

            go.transform.SetParent(transform);
            AnimationManager.Instance.AddAnimation(move2);
        }
Example #2
0
 public void NewHand()
 {
     _dealerButtonPosition = ++_dealerButtonPosition % Settings.NumberOfPlayers;     // Separate function?
     Hands.Add(new Hand(Players, _dealerButtonPosition));
     PayBlinds();
     _handInProgress = true;
 }
Example #3
0
    /// <summary>
    /// カードを1枚引く。
    /// </summary>
    /// <param name="card"></param>
    public void DrawCard(Card card)
    {
        if (card.Number == 1)
        {
            AddAce();
        }

        deck.DealCardAnime(card, this, false);
        TotalPoint += Mathf.Min(card.Number, 10);
        Hands.Add(card);
    }
Example #4
0
        public Game(Game game)
        {
            Dealer = new Hand(game.Dealer);

            foreach (Hand hand in game.Hands)
            {
                Hands.Add(new Hand(hand));
            }
            Deck     = new Deck(game.Deck);
            this.Rng = game.Rng;
        }
Example #5
0
    /// <summary>
    /// 裏向きでカードを引く。
    /// </summary>
    /// <param name="card"></param>
    private void DrawCardSecret(Card card)
    {
        if (card.Number == 1)
        {
            AddAce();
        }

        hiddenCard  = deck.DealCardAnime(card, this, true);
        TotalPoint += Mathf.Min(card.Number, 10);
        Hands.Add(card);
    }
Example #6
0
        private void Split(int currentHand)
        {
            Hand newHand = new Hand(Hands[currentHand].Bet);

            newHand.Cards = new List <Card>();
            newHand.Cards.Add(Hands[currentHand].Cards[0]);

            Hands.Remove(Hands[currentHand]);

            Hands.Add(newHand);
            Hands.Add((Hand)newHand.Clone());
        }
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Location);
                Hands.Add(newHand);
            }

            ActiveHand = state.ActiveHand;

            HandsModified();
        }
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Enabled, handState.Location);
                Hands.Add(newHand);
            }
            ActiveHand = state.ActiveHand;

            UpdateHandContainers();
            UpdateHandVisualizer();
            UpdateHandsGuiState();
        }
Example #9
0
        public override void HandleComponentState(ComponentState?curState, ComponentState?nextState)
        {
            if (curState is not HandsComponentState state)
            {
                return;
            }

            Hands.Clear();

            foreach (var handState in state.Hands)
            {
                var newHand = new Hand(handState.Name, handState.Location);
                Hands.Add(newHand);
            }

            ActiveHand = state.ActiveHand;

            UpdateHandContainers();
            UpdateHandVisualizer();
            Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage {
                Hands = this
            });
        }
Example #10
0
 public Game(Random rng)
 {
     this.Rng = rng;
     Deck     = new Deck(Rng);
     Hands.Add(new Hand());
 }