Exemplo n.º 1
0
        public List <ExtInput> GetVisionObjects()
        {
            var output = JsonUtility.FromJson <JOutput>(lastJson);

            var ret = new List <ExtInput>();
            int numBlues = 0, numReds = 0;

            foreach (var item in output.items)
            {
                var pos = visionBoundingBox.GetScreenPoint(CameraUtil.MainDimens(), item.pt);
                pos = PosAdjustments(pos);

                if (string.Equals(item.color, "blue"))
                {
                    var it = new ExtInput {
                        id = 100 + numBlues++, type = TileType.BLUE_ROD, position = pos
                    };
                    ret.Add(it);
                }
                else if (string.Equals(item.color, "red"))
                {
                    var it = new ExtInput {
                        id = 1000 + numReds++, type = TileType.RED_CUBE, position = pos
                    };
                    ret.Add(it);
                }
            }

            return(ret);
        }
Exemplo n.º 2
0
        Vector3 GetWorldPos(Vector3 editorPos)
        {
            var mDimens  = CameraUtil.MainDimens();
            var edDimens = visionHelper.GetCameraDimens();
            var x        = editorPos.x * (mDimens.x / edDimens.x);
            var y        = editorPos.y * (mDimens.y / edDimens.y);

            return(new Vector2(x, y));
        }