Exemplo n.º 1
0
        public static float ClockwiseAngle(this Player p)
        {
            for (int i = 0; i < rotations; i++)
                p = p.ClockwisePlayer();

            switch (Enum.GetName(typeof(Player), p)[3])
            {
                case '1':
                    return 0;
                case '2':
                    return (float) (Math.PI * 0.5);
                case '3':
                    return (float) (Math.PI);
                default:
                    return (float) (Math.PI * 1.5);
            }
        }
Exemplo n.º 2
0
        public static Rectangle GetRelativeRegion(this Player p)
        {
            int border = 4; // two borders between teams
            int rw = 250, rh = 175;

            for (int i = 0; i < rotations; i++)
                p = p.ClockwisePlayer();

            int row = (p.ID() == 3 || p.ID() == 4) ? 1 : 0;
            int col = (p.ID() == 1 || p.ID() == 4) ? 0 : 1;

            return new Rectangle(col * (rw + border), row * (rh + border), rw, rh);
        }
Exemplo n.º 3
0
        public static Rectangle GetRegion(this Player p)
        {
            int border = 4; // two borders between teams
            int rw = 250, rh = 175;

            for (int i = 0; i < rotations; i++)
                p = p.ClockwisePlayer();

            int row = (int) (p - 1) / 4;
            int col = (int) (p - 1) % 4;

            return new Rectangle(col * rw + (col + 1) * border + (((int)p.TeamOf() == 2 || (int)p.TeamOf() == 4) ? border : 0),
                                     row * rh + (row + 1) * border + (((int)p.TeamOf() == 3 || (int)p.TeamOf() == 4) ? border : 0),
                                     rw,
                                     rh);
        }