Exemple #1
0
        /// <summary>
        /// Obtiene el estado de la posición en la arena
        /// </summary>
        /// <param name="image"></param>
        /// <param name="place"></param>
        /// <returns></returns>
        public PositionState GetPositionState(Image image, Places place)
        {
            UtilsOcr     ocr      = new UtilsOcr();
            Navigation   nav      = new Navigation();
            DustPosition position = new DustPosition(place);

            image = ocr.CropImage(image, new Rectangle(position.x, position.y, position.xRange, position.yRange));

            if (nav.AreColorsSimilar(nav.GetPixelColor(image, 0, 0), Color.FromArgb(255, 243, 89)))
            {
                return(PositionState.MyPosition);
            }

            if (nav.AreColorsSimilar(nav.GetPixelColor(image, 6, 2), Color.FromArgb(188, 188, 188)))
            {
                return(PositionState.Played);
            }
            else
            {
                return(PositionState.UnPlayed);
            }
        }
Exemple #2
0
        /// <summary>
        /// Obtiene si ya se ha efectuado la pelea en la arena
        /// </summary>
        /// <param name="image"></param>
        /// <param name="place"></param>
        /// <returns></returns>
        public bool IsPositionBattleFinished(Image image, Places place)
        {
            UtilsOcr     ocr      = new UtilsOcr();
            Navigation   nav      = new Navigation();
            DustPosition position = new DustPosition(place);

            var matriz = new Rectangle(position.x, position.y, position.xRange, position.yRange);

            image = ocr.CropImage(image, matriz);

            for (int x = 0; x < position.xRange; x++)
            {
                for (int y = 0; y < position.yRange; y++)
                {
                    if (AreColorsSimilar(GetPixelColor(image, x, y), Color.FromArgb(113, 215, 48)))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }