Ejemplo n.º 1
0
        private void ProccessOperation(BoardOperation boardOp)
        {
            this.pendingOperations.Enqueue(() =>
            {
                var operationScore       = this.gameLogic.OperationScore(boardOp);
                this.score.CurrentScore += (float)operationScore;
            });

            if (boardOp.Type == OperationTypes.Remove)
            {
                this.ProccessRemoveOperation(boardOp);
            }
            else if (boardOp.Type == OperationTypes.Add)
            {
                this.ProccessAddOperation(boardOp);
            }
            else if (boardOp.Type == OperationTypes.Shuffle)
            {
                this.ProccessShuffleOperation();
            }

            if (boardOp.Type != OperationTypes.Remove)
            {
                this.pendingOperations.Enqueue(() =>
                {
                    foreach (var candyOp in boardOp.CandyOperations)
                    {
                        var candyAttr        = this.gameboardContent.FindCandyAttributes(candyOp.PreviousPosition);
                        candyAttr.Coordinate = candyOp.CurrentPosition;
                        candyAttr.Animator.RefreshPositionAnimation();
                    }
                });
            }
        }
        public int OperationScore(BoardOperation operation)
        {
            if (operation.Type == OperationTypes.Remove)
            {
                return(operation.CandyOperations.Count);
            }

            return(0);
        }
Ejemplo n.º 3
0
        private void ProccessRemoveOperation(BoardOperation boardOp)
        {
            this.pendingOperations.Enqueue(() =>
            {
                CustomServices.AudioPlayer.PlaySound(Services.Audio.Sounds.CandyBoom);
                foreach (var candyOp in boardOp.CandyOperations)
                {
                    var candyAttr = this.gameboardContent.FindCandyAttributes(candyOp.PreviousPosition);
                    candyAttr.Animator.SetDisappearAnimation();
                }
            });

            this.pendingOperations.Enqueue(() =>
            {
                foreach (var candyOp in boardOp.CandyOperations)
                {
                    this.gameboardContent.RemoveCandyEntity(candyOp.PreviousPosition);
                }
            });
        }
Ejemplo n.º 4
0
        private void ProccessAddOperation(BoardOperation boardOp)
        {
            this.pendingOperations.Enqueue(() =>
            {
                foreach (var candyOp in boardOp.CandyOperations)
                {
                    var candyAttr = this.gameboardContent.AddCandyEntity(candyOp.PreviousPosition, candyOp.CandyProperties.Value);

                    if (candyOp.PreviousPosition.Y >= 0)
                    {
                        candyAttr.Animator.SetAppearAnimation();
                        if (candyAttr.Type == CandyTypes.FourInLine)
                        {
                            CustomServices.AudioPlayer.PlaySound(Services.Audio.Sounds.ComboAppear);
                        }
                        else
                        {
                            CustomServices.AudioPlayer.PlaySound(Services.Audio.Sounds.ComboAppear2);
                        }
                    }
                }
            });
        }