public Player(TeamAI team, double radius, PointF loc, bool isFirstTeam) : base(team.getColor(), radius, loc) { this.ID = IDCounter++; this.team = team; this.isFirstTeam = isFirstTeam; }
public Form1() { InitializeComponent(); //---- TADY JSOU CLENOVE TYMU ---- List <AgentPlayer> agentsInTheTeam = new List <AgentPlayer>() { new AgentSimpleDefender(), new AgentSimpleOffender(), new AgentSimpleBallSeeker(), new AgentSimpleBallSeeker(), new AgentSimpleBallSeeker() }; // ---- TADY NASTAVTE JMENO VASEHO TYMU ---- TeamAI agentTeam = new AgentTeamAI("Dolní Lhota - přípravka", agentsInTheTeam); // ---- ZADNE DALSI VECI NENI POTREBA TADY MENIT ---- s = new Simulator(pictureBox1, new Playground(), FirstTeamName_label, SecondTeamName_label, score_label); TeamAI firstTeam = agentTeam, //new DistributedAI("Barcelona FC"),agentTeam secondTeam = new DistributedAI("Arsenal London"); //new AIZoneBasedTeam("TJ Sokol Nekopnemsi"); //new AIShooterTeam("TJ Sokol Nekopnemsi B"); //agentTeam; firstTeam.setColor(Color.DarkRed); secondTeam.setColor(Color.Cyan); s.setTeams(firstTeam, secondTeam); s.start(); //s.test(); timer1.Enabled = true; }
public void changeVelocity(TeamAI team, int playersID, PointF newVelocity) { if (players.ContainsKey(playersID)) { if (isOwnPlayer(team, playersID)) { players[playersID].setVelocity(scale(sum(scale(newVelocity, pg.maxPlayerSpeedChange), players[playersID].velocity), pg.maxPlayerSpeed)); } } }
public Rectangle getOppositeGoal(TeamAI team) { if (team == firstTeam) { return(pg.secondGoal); } if (team == secondTeam) { return(pg.firstGoal); } return(new Rectangle()); }
public List <int> getOpositePlayersIDs(TeamAI team) { List <int> result = new List <int>(); foreach (var item in players.Keys) { if (players[item].team.getName() != team.getName()) { result.Add(item); } } return(result); }
public void test() { PointF first = new PointF(200, 200), second = new PointF(100, 100), test = new PointF(150, 150); float width = 50; int i = 0; if (TeamAI.isInTest(first, second, width, test)) { i++; } }
public void moveBall(TeamAI team, int playersID, PointF newVelocity) { if (players.ContainsKey(playersID)) { if (isOwnPlayer(team, playersID)) { if (players[playersID].hasBall) { ball.velocity = scale(newVelocity, pg.maxBallSpeed); } } } }
public void showScore(TeamAI first, TeamAI second, Point score) { Font f = new Font("Arial", 15); firstTeamName.Text = first.getName(); firstTeamName.ForeColor = first.getColor(); firstTeamName.Font = f; secondTeamName.Text = second.getName(); secondTeamName.ForeColor = second.getColor(); secondTeamName.Font = f; scoreBoard.Text = score.X + " - " + score.Y; scoreBoard.Font = f; }
private bool isOwnPlayer(TeamAI team, int playersID) { return((team == firstTeam && players[playersID].isFirstTeam) || (team == secondTeam && !players[playersID].isFirstTeam)); }
public void setTeams(TeamAI first, TeamAI second) { this.firstTeam = first; this.secondTeam = second; //((AIChampionTeam)secondTeam).addDrawer(drawer); }
public Utils(Simulator sim, TeamAI team) { this.s = sim; this.t = team; initialize(); }