Exemple #1
0
        public void DropOffDiscs(BaGuaElementType type)
        {
            var element = GetElement(type);

            var discs        = element.RemoveAllDiscs();
            var dropLocation = element;

            for (int i = 0; i < discs.Length; i++)
            {
                dropLocation = _counterClockWiseElements[dropLocation];

                var disc = discs[i];
                dropLocation.AddDisc(disc);
            }

            DiscsDropped(new BaGuaDiscConfigurationChangedEvent
            {
                DiscsRemovedFrom  = element.Type,
                DiscConfiguration = _elements.Select(e => new BaGuaDiscConfigurationChangedEvent.ElementDiscs
                {
                    Discs       = e.GetDiscConfiguration(),
                    ElementType = e.Type
                }).ToArray()
            });
        }
Exemple #2
0
        public void RequestToDropOffDiscs(BaGuaElementType type)
        {
            var action = _baGuaWheel.DetermineAction(type);

            if (IsAllowedAction(action))
            {
                _baGuaWheel.DropOffDiscs(type);
                SelectAction(action);
            }
            else if (!_baGuaWheel.HasAValidMove(_currentPlayer, this))
            {
                _baGuaWheel.DropOffDiscs(type);
                SkipAction();
            }
            ;
        }
Exemple #3
0
 internal void RequestToDropDiscs(BaGuaElementType type)
 {
     GameEngine.RequestToDropOffDiscs(type);
 }
Exemple #4
0
        public BaGuaElement DetermineAction(BaGuaElementType type)
        {
            var element = GetElement(type);

            return(DetermineActionFor(element));
        }
Exemple #5
0
        public bool HasDiscsAt(BaGuaElementType type)
        {
            var element = GetElement(type);

            return(element.NumberOfDiscs != 0);
        }
Exemple #6
0
 private BaGuaElement GetElement(BaGuaElementType type)
 {
     return(_elements.Where(e => e.Type == type).First());
 }