private void OnTurned(object sender, TurnedEventArgs eventArgs) { _lastStepSource.Dispose(); _lastStepSource = null; if (Field.IsEnd()) { IsEnded = true; OnWin(CurrentStepPlayer); } Turned?.Invoke(sender, eventArgs); }
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)); }
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)); }
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; } } }
public DisplayContext(MainModel radio, Turned verify) { Radio = radio; this.verify = verify; }
public PowerContext(MainModel radio, Turned verify) { Radio = radio; this.verify = verify; }
protected virtual void OnTurn(PotentiometerTurn Event) { Turned?.Invoke(this, Event); }
protected virtual void OnTurn(EncoderTurn Event) { Turned?.Invoke(this, Event); }
public static bool OutOfRange(Turned value) => value < 0 || (int)value >= numberPosiotion;
private void setFirstTurned() { this.turned = Turned.Left; }
private void turnAround() { this.turned = (this.turned == Turned.Left) ? Turned.Right : Turned.Left; destinationVector = (-1) * destinationVector; spriteRenderer.flipX = !spriteRenderer.flipX; }
public StepConfiguration Power(Turned verify) { return(LoadContext(new PowerContext(radio, verify))); }
public StepConfiguration Display(Turned verify) { return(LoadContext(new DisplayContext(radio, verify))); }
public StepConfiguration Subrange(int switcher, Turned state) { return(LoadContext(new SubrangeSwither(radio, switcher, state))); }
public SubrangeSwither(MainModel radio, int switcher, Turned state) { this.switcher = switcher; this.state = state; Radio = radio; }
public void Turn(Lane.Direction newDirection) { direction = newDirection; Turned?.Invoke(this, new EventArgs()); //change lane }
public static bool ToBoolean(Turned value) => value == Turned.On;