Beispiel #1
0
        public Game()
        {
            currentThrow = new Throw();
            frames = new Frame[10];
            frame = new Frame(1);
            frames[0] = frame;
            throwCommand = new RelayCommand(ThrowCurrent);

            for (var i = 1; i < frames.Length; i++)
            {
                frames[i] = new Frame(i + 1);
                frames[i - 1].Next = frames[i];
                frames[i].Previous = frames[i - 1];
            }
        }
 public void Setup()
 {
     t = new Throw();
 }
Beispiel #3
0
        public void Add(Throw t)
        {
            if (!Finished)
            {
                if (!CanBonus)
                {
                    throws.Add(t);

                    if (throws.Count == 1)
                        RestPins -= t.Pins;
                    else
                        RestPins = 0;
                }
                else
                {
                    bonus.Add(t);
                }

                RaisePropertyChanged("Score");
                RaisePropertyChanged("LocalScore");
                RaisePropertyChanged("TotalScore");
                RaisePropertyChanged("Throw1");
                RaisePropertyChanged("Throw2");

                if (previous != null)
                    previous.Add(t);
            }
        }
Beispiel #4
0
        public void Add(Throw t)
        {
            frame.Add(t);

            if (frame.Done)
            {
                if (frame.Next != null)
                    CurrentFrame = frame.Next;
                else if (frame.RestPins == 0)
                    frame.RestPins = 10;

                Running = true;
            }

            RaisePropertyChanged("Score");
        }
Beispiel #5
0
 void ThrowCurrent()
 {
     Add(currentThrow);
     CurrentThrow = new Throw();
 }