Ejemplo n.º 1
0
 public void SetMat(IMat mat)
 {
     if (mat != null)
     {
         this.mat = mat;
     }
 }
Ejemplo n.º 2
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);
                }
            }
        }