Exemple #1
0
 public Player(TeamAI team, double radius, PointF loc, bool isFirstTeam)
     : base(team.getColor(), radius, loc)
 {
     this.ID          = IDCounter++;
     this.team        = team;
     this.isFirstTeam = isFirstTeam;
 }
Exemple #2
0
        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;
        }
Exemple #3
0
 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));
         }
     }
 }
Exemple #4
0
 public Rectangle getOppositeGoal(TeamAI team)
 {
     if (team == firstTeam)
     {
         return(pg.secondGoal);
     }
     if (team == secondTeam)
     {
         return(pg.firstGoal);
     }
     return(new Rectangle());
 }
Exemple #5
0
        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);
        }
Exemple #6
0
        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++;
            }
        }
Exemple #7
0
 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);
             }
         }
     }
 }
Exemple #8
0
        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;
        }
Exemple #9
0
 private bool isOwnPlayer(TeamAI team, int playersID)
 {
     return((team == firstTeam && players[playersID].isFirstTeam) ||
            (team == secondTeam && !players[playersID].isFirstTeam));
 }
Exemple #10
0
 public void setTeams(TeamAI first, TeamAI second)
 {
     this.firstTeam  = first;
     this.secondTeam = second;
     //((AIChampionTeam)secondTeam).addDrawer(drawer);
 }
Exemple #11
0
 public Utils(Simulator sim, TeamAI team)
 {
     this.s = sim;
     this.t = team;
     initialize();
 }