public Player(Position pos) { this.pos = pos; oldState = Keyboard.GetState(); reset(); }
public void addEnemy(EnemyType type, Position pos, int lifetime = 10 * 1000, int maxDimensionOfMovement = int.MaxValue) { Enemy n; switch (type) { case EnemyType.ZigZag0: { n = new ZigZag(type, pos, 0, lifetime, maxDimensionOfMovement); break; } case EnemyType.ZigZag1: { n = new ZigZag(type, pos, 1, lifetime, maxDimensionOfMovement); break; } case EnemyType.StraightLine: { n = new StraightLineEnemy(type, pos, lifetime, maxDimensionOfMovement); break; } default: { throw new NotImplementedException(); } } enemies.Add(n); }
protected Enemy(EnemyType type, Position pos, long lifeTime, int maxDimensionOfMovement, int damageAmount = 20) { this.pos = pos; this.type = type; this.maxDimensionOfMovement = maxDimensionOfMovement; deathTime = System.DateTime.Now.AddMilliseconds(lifeTime); this.damageAmount = damageAmount; }
//Color bg; public RenderPlane(Rectangle screenPosition, int xDimension, int yDimension, DimensionalManager dimensionalManager) { this.xDimension = xDimension; this.yDimension = yDimension; planePosition = new Position(yDimension); this.dimensionalManager = dimensionalManager; render2d = false; renderTarget = screenPosition; //this.bg = backgroundColour; }
public StraightLineEnemy(EnemyType type, Position pos, long lifeTime, int maxDimensionOfMovement) : base(type, pos, lifeTime, maxDimensionOfMovement) { speed = new List<float>(); }
public void UpdatePosition(Position newPosition) { planePosition = newPosition; }
private Vector2 getPlanarPosition(Position enemyPosition) { Vector2 planarPosition; if (render2d) { planarPosition = new Vector2(enemyPosition.GetPosition(xDimension), enemyPosition.GetPosition(yDimension)); } else { planarPosition = new Vector2(enemyPosition.GetPosition(xDimension), 0); } return planarPosition; }
private void drawLocation(SpriteBatch spriteBatch, Position position) { int getPlayerDimension = player.getCurrentDimension(); Vector2 stringPosition = Vector2.Zero; spriteBatch.DrawString(defaultFont14, "{", stringPosition, Color.White); stringPosition.X += defaultFont14.MeasureString("{").X; string startingPoint = position.GetPosition(0).ToString(); spriteBatch.DrawString(defaultFont14, startingPoint, stringPosition, getIndexColour(0, getPlayerDimension)); stringPosition.X += defaultFont14.MeasureString(startingPoint).X; for (int i = 1; i < dimensionalManager.GetNumberOfActiveDimensions(); ++i) { string point = ", " + position.GetPosition(i).ToString(); spriteBatch.DrawString(defaultFont14, point, stringPosition, getIndexColour(i, getPlayerDimension)); stringPosition.X += defaultFont14.MeasureString(point).X; } spriteBatch.DrawString(defaultFont14, "}", stringPosition, Color.White); }
public ZigZag(EnemyType type, Position pos, int dimToMoveIn, long lifeTime, int maxDimensionOfMovement) : base(type, pos, lifeTime, maxDimensionOfMovement) { this.dimToMoveIn = dimToMoveIn; }