public Timer(MatrixCoords topLeft) : base(topLeft, new char[,] { { 'P', 'O', 'I', 'N', 'T', 'S' }, { '0', '0', '0', '0', '0', '0' }, }) { }
public CollisionData(MatrixCoords collisionForceDirection, List<string> hitObjectsCollisionGroupStrings) { this.CollisionForceDirection = collisionForceDirection; this.HitObjectsCollisionGroupStrings = new List<string>(); foreach (var str in hitObjectsCollisionGroupStrings) { this.HitObjectsCollisionGroupStrings.Add(str); } }
public void EnqueueForRendering(IRenderable obj) { char[,] objImage = obj.GetImage(); int imageRows = objImage.GetLength(0); int imageCols = objImage.GetLength(1); MatrixCoords objTopLeft = obj.GetTopLeft(); int lastRow = Math.Min(objTopLeft.Row + imageRows, this.renderContextMatrixRows); int lastCol = Math.Min(objTopLeft.Col + imageCols, this.renderContextMatrixCols); for (int row = obj.GetTopLeft().Row; row < lastRow; row++) { for (int col = obj.GetTopLeft().Col; col < lastCol; col++) { if (row >= 0 && row < renderContextMatrixRows && col >= 0 && col < renderContextMatrixCols) { renderContextMatrix[row, col] = objImage[row - obj.GetTopLeft().Row, col - obj.GetTopLeft().Col]; } } } }
public Bomb(MatrixCoords topLeft, MatrixCoords speed) : base(topLeft, speed) { this.body = GetMyBody(); }
public MovingObject(MatrixCoords topLeft, char[,] body, MatrixCoords speed) : base(topLeft, body) { this.Speed = speed; }
public Enemy(MatrixCoords topLeft, MatrixCoords speed) : base(topLeft, new char[,] { { ' ' } }, speed) { this.body = GetMyBody(); }
public CollisionData(MatrixCoords collisionForceDirection, string objectCollisionGroupString) { this.CollisionForceDirection = collisionForceDirection; this.HitObjectsCollisionGroupStrings = new List<string>(); this.HitObjectsCollisionGroupStrings.Add(objectCollisionGroupString); }
protected GameObject(MatrixCoords topLeft, char[,] body) { this.TopLeft = topLeft; this.body = this.CopyBodyMatrix(body); this.IsDestroyed = false; }
public CollisionData(MatrixCoords collisionForceDirection, string objectCollisionGroupString) { this.CollisionForceDirection = collisionForceDirection; this.HitObjectsCollisionGroupStrings = new List <string>(); this.HitObjectsCollisionGroupStrings.Add(objectCollisionGroupString); }
public static MatrixCoords Set(MatrixCoords a, int row, int col) { a.Row = row; a.Col = col; return a; }
public SuperEvil(MatrixCoords topLeft, MatrixCoords speed) : base(topLeft, speed) { }
public Mario(MatrixCoords topLeft) : base(topLeft, new char[,] { { ' ' } }) { this.body = GetMyBody(); }
public DisplayLives(MatrixCoords topLeft) : base(topLeft, new char[,] { { 'L', 'I', 'V', 'E', 'S', ':', '3' } }) { this.Lives = 3; }
public override bool Equals(object obj) { MatrixCoords objAsMatrixCoords = (MatrixCoords)obj; return(objAsMatrixCoords.Row == this.Row && objAsMatrixCoords.Col == this.Col); }
private static void HandleMovingWithStaticCollisions(List<MovingObject> movingObjects, List<GameObject> staticObjects) { foreach (var movingObject in movingObjects) { int verticalIndex = VerticalCollisionIndex(movingObject, staticObjects); int horizontalIndex = HorizontalCollisionIndex(movingObject, staticObjects); MatrixCoords movingCollisionForceDirection = new MatrixCoords(0, 0); if (verticalIndex != -1) { movingCollisionForceDirection.Row = -movingObject.Speed.Row; staticObjects[verticalIndex].RespondToCollision(new CollisionData(new MatrixCoords(movingObject.Speed.Row, 0), movingObject.GetCollisionGroupString())); } if (horizontalIndex != -1) { movingCollisionForceDirection.Col = -movingObject.Speed.Col; staticObjects[horizontalIndex].RespondToCollision(new CollisionData(new MatrixCoords(0, movingObject.Speed.Col), movingObject.GetCollisionGroupString())); } int diagonalIndex = -1; if (horizontalIndex == -1 && verticalIndex == -1) { diagonalIndex = DiagonalCollisionIndex(movingObject, staticObjects); if (diagonalIndex != -1) { movingCollisionForceDirection.Row = -movingObject.Speed.Row; movingCollisionForceDirection.Col = -movingObject.Speed.Col; staticObjects[diagonalIndex].RespondToCollision(new CollisionData(new MatrixCoords(movingObject.Speed.Row, 0), movingObject.GetCollisionGroupString())); } } List<string> hitByMovingCollisionGroups = new List<string>(); if (verticalIndex != -1) { hitByMovingCollisionGroups.Add(staticObjects[verticalIndex].GetCollisionGroupString()); } if (horizontalIndex != -1) { hitByMovingCollisionGroups.Add(staticObjects[horizontalIndex].GetCollisionGroupString()); } if (diagonalIndex != -1) { hitByMovingCollisionGroups.Add(staticObjects[diagonalIndex].GetCollisionGroupString()); } if (verticalIndex != -1 || horizontalIndex != -1 || diagonalIndex != -1) { movingObject.RespondToCollision(new CollisionData(movingCollisionForceDirection, hitByMovingCollisionGroups)); } } }