Ejemplo n.º 1
0
        private void OnTurned(object sender, TurnedEventArgs eventArgs)
        {
            _lastStepSource.Dispose();
            _lastStepSource = null;

            if (Field.IsEnd())
            {
                IsEnded = true;
                OnWin(CurrentStepPlayer);
            }

            Turned?.Invoke(sender, eventArgs);
        }
Ejemplo n.º 2
0
        public Task ForceTurn(int x, int y, CancellationToken cancellationToken)
        {
            if (!_canTurn || _bot.Field[x, y].State != CellState.Empty)
            {
                return(Task.FromResult(false));
            }

            return(Task.Delay(Game.BotStepDelay, cancellationToken).ContinueWith(task =>
            {
                _canTurn = false;
                _bot.Field.Turn(_bot.State, x, y);
                Turned?.Invoke(this, new TurnedEventArgs {
                    CellState = PlayerCellState, X = x, Y = y
                });
            }, cancellationToken));
        }
Ejemplo n.º 3
0
        public Task ForceTurn(int x, int y, CancellationToken cancellationToken)
        {
            return(Task.Run(() =>
            {
                if (!_canTurn || Field[x, y].State != CellState.Empty)
                {
                    return;
                }

                Field.Turn(PlayerCellState, x, y);
                _canTurn = false;
                Turned?.Invoke(this, new TurnedEventArgs {
                    CellState = PlayerCellState, X = x, Y = y
                });
            }, cancellationToken));
        }
Ejemplo n.º 4
0
 public void turnAccordingWithVectorAlongX(Vector3 _destinationVector)
 {
     if (_destinationVector.x < 0)
     {
         if (this.turned == Turned.Right)
         {
             this.spriteRenderer.flipX = !this.spriteRenderer.flipX;
             this.turned = Turned.Left;
         }
     }
     else if (_destinationVector.x > 0)
     {
         if (this.turned == Turned.Left)
         {
             this.spriteRenderer.flipX = !this.spriteRenderer.flipX;
             this.turned = Turned.Right;
         }
     }
 }
Ejemplo n.º 5
0
 public DisplayContext(MainModel radio, Turned verify)
 {
     Radio       = radio;
     this.verify = verify;
 }
Ejemplo n.º 6
0
 public PowerContext(MainModel radio, Turned verify)
 {
     Radio       = radio;
     this.verify = verify;
 }
Ejemplo n.º 7
0
 protected virtual void OnTurn(PotentiometerTurn Event)
 {
     Turned?.Invoke(this, Event);
 }
Ejemplo n.º 8
0
 protected virtual void OnTurn(EncoderTurn Event)
 {
     Turned?.Invoke(this, Event);
 }
Ejemplo n.º 9
0
 public static bool OutOfRange(Turned value) => value < 0 || (int)value >= numberPosiotion;
Ejemplo n.º 10
0
 private void setFirstTurned()
 {
     this.turned = Turned.Left;
 }
Ejemplo n.º 11
0
 private void turnAround()
 {
     this.turned          = (this.turned == Turned.Left) ? Turned.Right : Turned.Left;
     destinationVector    = (-1) * destinationVector;
     spriteRenderer.flipX = !spriteRenderer.flipX;
 }
Ejemplo n.º 12
0
 public StepConfiguration Power(Turned verify)
 {
     return(LoadContext(new PowerContext(radio, verify)));
 }
Ejemplo n.º 13
0
 public StepConfiguration Display(Turned verify)
 {
     return(LoadContext(new DisplayContext(radio, verify)));
 }
Ejemplo n.º 14
0
 public StepConfiguration Subrange(int switcher, Turned state)
 {
     return(LoadContext(new SubrangeSwither(radio, switcher, state)));
 }
Ejemplo n.º 15
0
 public SubrangeSwither(MainModel radio, int switcher, Turned state)
 {
     this.switcher = switcher;
     this.state    = state;
     Radio         = radio;
 }
Ejemplo n.º 16
0
 public void Turn(Lane.Direction newDirection)
 {
     direction = newDirection;
     Turned?.Invoke(this, new EventArgs());
     //change lane
 }
Ejemplo n.º 17
0
 public static bool ToBoolean(Turned value) => value == Turned.On;