Example #1
0
        /// <summary>
        /// 满足右攻假设,获取双方在*蓝方*视角下的SideInfo
        /// 首先根据当前信息构造SideInfo,然后如果需要的是黄方数据,为了满足右攻假设,进行视角的转换
        /// </summary>
        /// <param name="side"></param>
        /// <returns></returns>
        public SideInfo GetSide(Side side)
        {
            SideInfo si = new SideInfo
            {
                currentBall = Ball,
            };

            Robot[] home = null, opp = null;
            if (side == Side.Blue)
            {
                (home, opp) = (BlueRobots, YellowRobots);
            }
            else if (side == Side.Yellow)
            {
                (home, opp) = (YellowRobots, BlueRobots);
            }
            si.home = (Robot[])home.Clone();
            si.opp  = (from rb in opp
                       select new OpponentRobot {
                pos = rb.pos, rotation = rb.rotation
            }).ToArray();
            if (side == Side.Yellow)
            {
                si.ConvertToAnotherSide();
            }
            si.TickMatch = TickMatch;
            return(si);
        }
Example #2
0
        public SideInfo GetBlueSide()
        {
            SideInfo rv = new SideInfo {
                currentBall = CurrentBall,
                whosBall    = WhosBall,
                gameState   = GameState
            };

            for (int i = 0; i < 5; i++)
            {
                rv.home[i] = BlueRobot[i];
                rv.opp[i]  = new OpponentRobot {
                    pos      = YellowRobot[i].pos,
                    rotation = YellowRobot[i].rotation
                };
            }
            return(rv);
        }
Example #3
0
        public SideInfo GetYellowSide()
        {
            SideInfo rv = new SideInfo {
                currentBall = CurrentBall,
                whosBall    = WhosBall,
                gameState   = GameState
            };

            for (int i = 0; i < 5; i++)
            {
                rv.home[i] = YellowRobot[i];
                rv.opp[i]  = new OpponentRobot {
                    pos      = BlueRobot[i].pos,
                    rotation = BlueRobot[i].rotation
                };
            }
            // 转换坐标
            if (GeneralConfig.EnableConvertYellowData)
            {
                rv.ConvertToOtherSide();
            }
            return(rv);
        }