public PlayerRenderContext(PlayerContext playerContext, Motion motion) { this.Name = playerContext.Name; this.Number = playerContext.Number; this.Score = playerContext.Score; this.Motion = motion; this.LastPos = playerContext.LastPos; this.Power = playerContext.Power; this.Stun = playerContext.Stun; }
private void processCommandTurn(ContextContainer contextContainer, PlayerContext playerContext, List<PlayerRenderContext> renderContexts, List<TurnAction> actions) { switch (playerContext.Command) { case Arrow.UP: if (playerContext.LastPos >= Config.BlockCol) renderContexts.Add(this.processRenderContext(contextContainer, playerContext.Number, actions, playerContext.LastPos - Config.BlockCol, Motion.UP)); else renderContexts.Add(new PlayerRenderContext(playerContext, Motion.STAND_UP)); break; case Arrow.RIGHT: if ((playerContext.LastPos % Config.BlockCol) < (Config.BlockCol - 1)) renderContexts.Add(this.processRenderContext(contextContainer, playerContext.Number, actions, playerContext.LastPos + 1, Motion.RIGHT)); else renderContexts.Add(new PlayerRenderContext(playerContext, Motion.STAND_RIGHT)); break; case Arrow.DOWN: if (playerContext.LastPos < Config.BlockCol * (Config.BlockRow - 1)) renderContexts.Add(this.processRenderContext(contextContainer, playerContext.Number, actions, playerContext.LastPos + Config.BlockCol, Motion.DOWN)); else renderContexts.Add(new PlayerRenderContext(playerContext, Motion.STAND_DOWN)); break; case Arrow.LEFT: if ((playerContext.LastPos % Config.BlockCol) > 0) renderContexts.Add(this.processRenderContext(contextContainer, playerContext.Number, actions, playerContext.LastPos - 1, Motion.LEFT)); else renderContexts.Add(new PlayerRenderContext(playerContext, Motion.STAND_LEFT)); break; } }
private void processStunTurn(PlayerContext playerContext, List <PlayerRenderContext> renderContexts) { playerContext.Stun--; renderContexts.Add(new PlayerRenderContext(playerContext, Motion.TURN)); }
private void processStunTurn(PlayerContext playerContext, List<PlayerRenderContext> renderContexts) { playerContext.Stun--; renderContexts.Add(new PlayerRenderContext(playerContext, Motion.TURN)); }