示例#1
0
        public void Initialize(IList <IRobot> robots, string matDetails, bool isSinglePlayer = true)
        {
            if (!String.IsNullOrEmpty(matDetails))
            {
                SquareMatConfiguration squareMatConfiguration = JsonConvert.DeserializeObject <SquareMatConfiguration>(matDetails);

                if (squareMatConfiguration != null)
                {
                    mat = new SquareCardMat(squareMatConfiguration.Width);
                }
            }

            if (mat == null)
            {
                mat = new SquareCardMat();
            }

            this.isSinglePlayer = isSinglePlayer;

            if (robots != null && robots.Count > 0)
            {
                this.robots = robots;

                foreach (IRobot robot in Robots)
                {
                    robot.SetMat(mat);
                }

                if (IsSinglePlayer)
                {
                    SetActiveRobot((robots.FirstOrDefault() as IHaveIdentifier).Guid);
                }
            }
        }
示例#2
0
        private void ChallengeIsInitialized()
        {
            _challenge = new SquareCardMatChallenge();
            List <IRobot> robots = new List <IRobot>()
            {
                new Robot("TestRobot", new Guid("{44684A66-7BF3-4F6B-969D-BC0F40CAEC10}"))
            };

            SquareMatConfiguration squareMat = new SquareMatConfiguration();

            squareMat.Width = 5;
            _challenge.Initialize(robots, JsonConvert.SerializeObject(squareMat));
        }