public Climby(CoordHelper.EProfile pt) : base(App.Game) { playerType = pt; if (playerType == CoordHelper.EProfile.ONEPLAYER) skin = SpriteManager.ESprite.CLIMBYBLUE; else skin = SpriteManager.ESprite.CLIMBYRED; pos = new Vector2(CoordHelper.Instance.getLeftMargin(playerType) + Constants.Measures.boardWidth / 2, Constants.Measures.upBoardMargin + Constants.Measures.boardHeight - Constants.Measures.blockSize); actualPosition = new Rectangle((int)pos.X, (int)pos.Y, (int)Constants.Measures.blockSize, (int)Constants.Measures.blockSize); deadZone = new Rectangle((int)pos.X + (int)(Constants.Measures.blockSize / 3), (int)pos.Y + (int)(Constants.Measures.blockSize / 3), (int)(Constants.Measures.blockSize / 3), (int)(Constants.Measures.blockSize / 3)); actions = new Dictionary<EState, Action<GameTime>>(); #region Actions actions.Add(EState.CLIMB, climb); actions.Add(EState.END_CLIMB, move); actions.Add(EState.FALL, move); actions.Add(EState.FREE_FALL, fall); actions.Add(EState.MOVE, move); actions.Add(EState.STOP, stop); #endregion state = EState.MOVE; direction = EDirection.RIGHT; rotation = 0f; setSpeedFromLevel(0); influence = 1f; minHeight = (int)((pos.Y - Constants.Measures.upBoardMargin) / Constants.Measures.blockSize); oldMinHeight = minHeight; }
public GameSession(CoordHelper.EProfile pt, HUD h) : base(App.Game) { hud = h; playerType = pt; board = new Board(playerType, new Vector2(Constants.Measures.boardBlockWidth, Constants.Measures.boardBlockHeight)); climby = new Climby(playerType); // aroundRect = new Dictionary<Climby.EAroundSquare, Point>(); #region Set Around Rect aroundRect.Add(Climby.EAroundSquare.FRONT, Point.Zero); aroundRect.Add(Climby.EAroundSquare.FRONT_TOP, Point.Zero); aroundRect.Add(Climby.EAroundSquare.FRONT_UNDER, Point.Zero); aroundRect.Add(Climby.EAroundSquare.FRONT_UNDER_UNDER, Point.Zero); aroundRect.Add(Climby.EAroundSquare.TOP, Point.Zero); aroundRect.Add(Climby.EAroundSquare.UNDER, Point.Zero); #endregion lastDir = climby.Direction; // tetriminoFactory = TetriminoFactory.Instance; var tmp = tetriminoFactory.getTetrimino(playerType); currTetrimino = tmp.Item1; shadowTetrimino = tmp.Item2; hud.setNext(TetriminoFactory.Instance.getNextTetrimino(playerType), playerType); cur = TimeSpan.Zero; //lat = new TimeSpan(10000000/3); // 3 score = new Score(); level = new Level(); //lat = new TimeSpan(10000000 / (level.level + 1)); lat = new TimeSpan((10 - level.level) * 1000000); //lat = new TimeSpan(2 / (level.level + 1) * 10000000); tSpinLimit = new TimeSpan(1000000 * 3); // TSPIN TIME tSpinCur = TimeSpan.Zero; state = new Dictionary<Climby.EState, Action>(); #region Climby State state.Add(Climby.EState.FALL, climbyFall); state.Add(Climby.EState.FREE_FALL, climbyFreeFall); state.Add(Climby.EState.CLIMB, climbyClimb); state.Add(Climby.EState.END_CLIMB, climbyClimb); state.Add(Climby.EState.MOVE, climbyMove); state.Add(Climby.EState.STOP, climbyStop); #endregion updateAroundRects(); }
public Board(CoordHelper.EProfile pt, Vector2 size) : base(App.Game) { playerType = pt; this.size = size; pos = new Rectangle((int)(CoordHelper.Instance.getLeftMargin(playerType)), (int)(Constants.Measures.upBoardMargin), (int)(size.X * Constants.Measures.blockSize), (int)(size.Y * Constants.Measures.blockSize)); grid = new Block[(int)size.Y][]; limitLineHeight = 4; for (int i = 0; i < grid.Length; i++) { grid[i] = new Block[(int)size.X]; for (int j = 0; j < (int)size.X; j++) grid[i][j] = null; } if (SettingsManager.Instance.Device != SettingsManager.EDevice.SURFACE) { Constants.Measures.leftBoardMargin = (Constants.Measures.portraitWidth - Constants.Measures.boardWidth) / 2; } }