public Simulator(PictureBox p, Playground pg, Label f, Label s, Label sc) { this.drawer = new DrawingUnit(p, pg, f, s, sc); this.objects = new List <MovingObject>(); this.pg = pg; this.players = new Dictionary <int, Player>(); this.score = new Point(0, 0); this.activePlayers = new List <Player>(); }
public DrawingUnit(PictureBox pictureBox, Playground p, Label firstName, Label secondName, Label scoreBoard) { this.pictureBox = pictureBox; sizeX = pictureBox.Width; sizeY = pictureBox.Height; pictureBox.Image = new Bitmap(sizeX, sizeY); g = Graphics.FromImage(pictureBox.Image); this.p = p; drawEmptyField(); this.firstTeamName = firstName; this.secondTeamName = secondName; this.scoreBoard = scoreBoard; }
protected void initialize() { playground = s.getPlayground(); enemyGoal = s.getOppositeGoal(this); myPlayers = s.getPlayersIDs(this); opositePlayers = s.getOpositePlayersIDs(this); allPlayers = new List <int>(myPlayers.Count + opositePlayers.Count); allPlayers.AddRange(myPlayers); allPlayers.AddRange(opositePlayers); enemyGoalCentralPoint = new PointF(enemyGoal.X + enemyGoal.Width / 2, enemyGoal.Y + enemyGoal.Height / 2); Rectangle friendlyGoal = s.getGoal(this); friendlyGoalCentralPoint = new PointF(friendlyGoal.X + friendlyGoal.Width / 2, friendlyGoal.Y + friendlyGoal.Height / 2); locations = new Dictionary <int, PointF>(allPlayers.Count); velocities = new Dictionary <int, PointF>(allPlayers.Count); alreadySet = new List <int>(); playersTargets = new Dictionary <int, PointF>(); this.isInitialized = true; }