Example #1
0
    private void addSpawnEvent(BlobData blobData, float preferredSpawnTime, bool useFrequencySafeguard)
    {
        /*
        adds to the spawn event list, taking into account the direction and speed of the blobData

        useFrequencySafeguard ensures collisions will not be too close together
        */

        float spawnTime = preferredSpawnTime;
        if (useFrequencySafeguard) {
            float safeSpawnTime = getSafeSpawnTime (blobData);
            spawnTime = Mathf.Max (safeSpawnTime, preferredSpawnTime);
            if (spawnTime != preferredSpawnTime)
                Debug.Log ("info: used safeSpawnTime: " + safeSpawnTime + " instead of preferredSpawnTime: " + preferredSpawnTime);
        }

        SpawnEvent spawnEvent = new SpawnEvent (blobData, spawnTime);

        bool added = false;
        for (int i=0; i<spawnEvents.Count; i++) {
            SpawnEvent compareEvent = (SpawnEvent)spawnEvents [i];
            if (spawnEvent.time < compareEvent.time) {
                spawnEvents.Insert (i, spawnEvent);
                added = true;
                break;
            }
        }

        if (!added)
            spawnEvents.Add (spawnEvent);
    }
Example #2
0
        static void Main(string[] args)
        {
            var blobFactory = new BlobFactory();
            var reader =  new ConsoleReader();
            var writer = new ConsoleWriter();
            var data = new BlobData();

            var engine = new Engine(blobFactory, data, reader, writer);
            engine.Run();
        }
Example #3
0
    public SandboxMenu()
    {
        mainBackground = Resources.Load ("Textures/SandboxGUI") as Texture;
        titleStyle = MenuTemplate.getLabelStyle (20, TextAnchor.UpperLeft, Color.black);
        //createStyle = MenuTemplate.getLabelStyle (25, TextAnchor.UpperCenter, Color.black);
        normalStyle = MenuTemplate.getLabelStyle (40, TextAnchor.UpperRight, Color.black);

        sliderWidth = Screen.width / 3;
        sliderSpace = Screen.width / 10;
        blobData = BlobData.getBlobData ("sandbox");

        setupEnumSliders ();
    }
Example #4
0
    public BlobManager genBlob(BlobData blobData)
    {
        /*
        this is all worldManager needs to create a blob using blobData
        */

        IntVector3 startPosition = getBlobStartPosition (blobData);
        BlobManager blobManager = startBlob (getNewBlob (), blobData.getMapData (), startPosition);

        blobManager.setBlobData (blobData);
        blobManager.createVoxels ();

        blobManager.setVelocity (blobData.getVelocity (), getDriftFuel (blobData));
        return blobManager;
    }
Example #5
0
        public async Task <BlobData> GetBlobById(string blobReference, string blobContainerReference)
        {
            // Retrieve reference to a blob
            BlobClient blobBlock = _blobContainerClient.GetBlobClient(blobReference);

            using (var memoryStream = new MemoryStream())
            {
                await blobBlock.DownloadToAsync(memoryStream);

                var blob = new BlobData()
                {
                    Bytes    = memoryStream.ToArray(),
                    FileName = blobReference,
                    Url      = blobBlock.Uri.ToString()
                };

                return(blob);
            }
        }
Example #6
0
        /// <summary>
        /// Retrieve the object.
        /// </summary>
        /// <returns>Crawl result.</returns>
        public CrawlResult Get()
        {
            CrawlResult ret = new CrawlResult();

            try
            {
                BlobData data = _Blobs.GetStream(Key).Result;
                ret.Metadata      = CrawlResult.ObjectMetadata.FromBlobMetadata(_Blobs.GetMetadata(Key).Result);
                ret.ContentLength = data.ContentLength;
                ret.DataStream    = data.Data;
                ret.Success       = true;
            }
            catch (Exception e)
            {
                ret.Exception = e;
            }

            ret.Time.End = DateTime.UtcNow;
            return(ret);
        }
Example #7
0
        private static XDocument CreateDocumentFromBlobData(BlobData blobData)
        {
            if (blobData == null || blobData.BlobContents.Length == 0)
            {
                return(new XDocument(new XElement(RepositoryElementName)));
            }

            using var memoryStream = new MemoryStream(blobData.BlobContents);

            var xmlReaderSettings = new XmlReaderSettings()
            {
                DtdProcessing = DtdProcessing.Prohibit,
                IgnoreProcessingInstructions = true,
            };

            using (var xmlReader = XmlReader.Create(memoryStream, xmlReaderSettings))
            {
                return(XDocument.Load(xmlReader));
            }
        }
Example #8
0
        /// <summary>
        /// Retrieve the object asynchronously.
        /// </summary>
        /// <param name="token">Cancellation token to cancel the request.</param>
        /// <returns>Crawl result.</returns>
        public async Task <CrawlResult> GetAsync(CancellationToken token = default)
        {
            CrawlResult ret = new CrawlResult();

            try
            {
                BlobData data = await _Blobs.GetStream(Key, token).ConfigureAwait(false);

                ret.Metadata      = CrawlResult.ObjectMetadata.FromBlobMetadata(await _Blobs.GetMetadata(Key, token).ConfigureAwait(false));
                ret.ContentLength = data.ContentLength;
                ret.DataStream    = data.Data;
                ret.Success       = true;
            }
            catch (Exception e)
            {
                ret.Exception = e;
            }

            ret.Time.End = DateTime.UtcNow;
            return(ret);
        }
        private static Marker GetClosestMarker(IEnumerable <Marker> markers, BlobData blob, out double retDistance)
        {
            Marker candidate     = null;
            var    leastDistance = double.MaxValue;

            foreach (var marker in markers)
            {
                var distance = (marker.Center - blob.Center).Length;

                if (leastDistance < distance)
                {
                    continue;
                }

                candidate     = marker;
                leastDistance = distance;
            }

            retDistance = leastDistance;
            return(candidate);
        }
        private void UpdateDevice(BlobData blob, Marker marker = null)
        {
            var device = Devices.Single(d => d.BlobId == blob.Id);
            var center = new Point(blob.Center.X, blob.Center.Y);

            device.Key = blob.Key;
            //device.BlobId = blob.Id;
            device.Center = center;
            device.State  = blob.State;
            device.Shape  = blob.Polygon;
            device.Area   = blob.Area;

            if (marker != null)
            {
                device.DeviceId               = marker.Id;
                device.IsIdentified           = true;
                device.Angle                  = marker.Angle;
                device.RgbImageToDisplayRatio = marker.RgbImageToDisplayRatio;
            }
            else
            {
                var deltaAngle = blob.Angle - device.LastBlobAngle;

                // this is a hack but it works pretty good
                //if (deltaAngle > 45)
                //{
                //    deltaAngle -= 90;
                //    //return;
                //}
                //else if (deltaAngle < -45)
                //{
                //    deltaAngle += 90;
                //}

                //Console.WriteLine("Delta Angle {0}", deltaAngle);

                device.LastBlobAngle = blob.Angle;
                device.Angle        += deltaAngle;
            }
        }
    public void RegisterBlobData(Vector3 position, float range, float duration, float wavelength, float maxAmplitude, float speed)
    {
        BlobData newData = new BlobData();

        newData.position   = position;
        newData.maxRange   = range;
        newData.duration   = duration;
        newData.wavelength = wavelength;
        newData.amplitude  = maxAmplitude;
        newData.speed      = speed;
        newData.timer      = 0f;
        newData.progress   = 0f;


        //we always store the newest impact at index 0 and shift all others
        for (int i = 0; i < blobData.Length - 1; i++)
        {
            blobData[i + 1] = blobData[i];//shift all blobdata and overwrite oldest if array is already full
        }
        blobData[0] = newData;

        activeBlobDataIndex = Mathf.Min(blobData.Length - 1, activeBlobDataIndex + 1);//increment number of active blobs

        /*
         * if(activeBlobDataIndex >= blobData.Length) {//if the array is already full with active blobsies, we replace the one at index 0
         *
         *  for (int i = 0; i < blobData.Length - 1; i++) {//we shift the existing blobdata
         *      blobData[i] = blobData[i+1];
         *  }
         *  blobData[blobData.Length - 1] = newData;//and add the new data at the bottom of the array
         *
         * } else {
         *  blobData[activeBlobDataIndex] = newData;
         *  activeBlobDataIndex++;
         * }
         */
    }
Example #12
0
    private float getSafeSpawnTime(BlobData blobData)
    {
        //returns the earliest time it is safe to spawn the blob from its direction

        float highestCollisionTime = 0;
        foreach (SpawnEvent spawnEvent in spawnEvents) {
            if (spawnEvent.blobData.getMoveDirection () != blobData.getMoveDirection ())
                continue;
            float driftTime = spawnEvent.blobData.getDriftTime ();
            float collisionTime = driftTime + spawnEvent.time;

            highestCollisionTime = Mathf.Max (highestCollisionTime, collisionTime);
        }

        if (highestCollisionTime == 0) {
            return 0;
        } else {
            float safeTime = highestCollisionTime - blobData.getDriftTime ();
            safeTime += GameSettings.collisionWait;
            //Debug.Log (highestCollisionTime + " " + blobData.getDriftTime () + " " + GameSettings.collisionWait);
            return safeTime;
        }
    }
Example #13
0
 public SpawnEvent(BlobData blobData, float time)
 {
     this.blobData = blobData;
     this.time = time;
 }
Example #14
0
 public void setBlobData(BlobData blobData)
 {
     this.blobData = blobData;
 }
Example #15
0
    private void applyWaveData(BlobData blobData, WaveData waveData, int frequencyIndex)
    {
        Directions.Cardinal direction = waveData.genDirection ();
        if (direction != Directions.Cardinal.unknown)
            blobData.moveDirection = direction;

        float sizeMultiplier = waveData.genSizeMultiplier (frequencyIndex);
        IntVector3 blobSize = blobData.getSize ();
        blobData.setSize (blobSize * sizeMultiplier);

        Vector2 offsetMultiplier = waveData.genOffset ();
        IntVector3 mainSize = worldManager.getMainSizeVector ();
        IntVector2 collisionSize= MDCollision.getCollisionArraySize(blobData.getSizeVector(),blobData.getMoveDirectionUnitVector());
        blobData.offset.x = (int)(collisionSize.x * offsetMultiplier.x);
        blobData.offset.y = (int)(collisionSize.y * offsetMultiplier.y);
    }
        public HttpResponseMessage UpdateBlobDataToDB(BlobData blobData)
        {
            try
            {
                SqlConnection conn    = null;
                SqlCommand    command = null;

                var connectionString = string.Empty;
                var json             = string.Empty;
                connectionString = ConfigurationManager.AppSettings["ConnectionString"];

                conn    = new SqlConnection(connectionString);
                command = new SqlCommand("BlobStorageIns", conn);
                command.CommandTimeout = 0;

                command.CommandType = CommandType.StoredProcedure;
                conn.Open();

                command.Parameters.Add("@filePath", SqlDbType.VarChar, 255);
                command.Parameters.Add("@fileExt", SqlDbType.VarChar, 10);
                command.Parameters.Add("@senderNumber", SqlDbType.VarChar, 30);
                command.Parameters.Add("@senderLat", SqlDbType.Decimal);
                command.Parameters.Add("@senderLong", SqlDbType.Decimal);
                command.Parameters.Add("@adminArea", SqlDbType.VarChar, 50);
                command.Parameters.Add("@countryCode", SqlDbType.VarChar, 50);
                command.Parameters.Add("@countryName", SqlDbType.VarChar, 50);
                command.Parameters.Add("@featureName", SqlDbType.VarChar, 50);
                command.Parameters.Add("@locality", SqlDbType.VarChar, 50);
                command.Parameters.Add("@postalCode", SqlDbType.VarChar, 50);
                command.Parameters.Add("@subAdminArea", SqlDbType.VarChar, 50);
                command.Parameters.Add("@subLocality", SqlDbType.VarChar, 50);
                command.Parameters.Add("@subThoroughFare", SqlDbType.VarChar, 50);
                command.Parameters.Add("@thoroughFare", SqlDbType.VarChar, 50);
                command.Parameters.Add("@createdOn", SqlDbType.DateTime);

                command.Parameters["@filePath"].Value        = blobData.filePath;
                command.Parameters["@fileExt"].Value         = blobData.fileExt;
                command.Parameters["@senderNumber"].Value    = blobData.senderNumber;
                command.Parameters["@senderLat"].Value       = blobData.senderLat;
                command.Parameters["@senderLong"].Value      = blobData.senderLong;
                command.Parameters["@adminArea"].Value       = blobData.adminArea;
                command.Parameters["@countryCode"].Value     = blobData.countryCode;
                command.Parameters["@countryName"].Value     = blobData.countryName;
                command.Parameters["@featureName"].Value     = blobData.featureName;
                command.Parameters["@locality"].Value        = blobData.locality;
                command.Parameters["@postalCode"].Value      = blobData.postalCode;
                command.Parameters["@subAdminArea"].Value    = blobData.subAdminArea;
                command.Parameters["@subLocality"].Value     = blobData.subLocality;
                command.Parameters["@subThoroughFare"].Value = blobData.subThoroughFare;
                command.Parameters["@thoroughFare"].Value    = blobData.thoroughFare;
                command.Parameters["@createdOn"].Value       = DateTime.UtcNow;

                command.ExecuteNonQuery();

                conn.Close();
                conn.Dispose();

                HttpResponseMessage response = Request.CreateResponse <BlobData>(HttpStatusCode.Created, blobData);
                return(response);
            }
            catch (Exception exception)
            {
                {
                    var errorMessagError
                        = new System.Web.Http.HttpError(exception.Message)
                        {
                        { "ErrorCode", 405 }
                        };

                    throw new
                          HttpResponseException
                              (ControllerContext.Request.CreateErrorResponse(HttpStatusCode.MethodNotAllowed, errorMessagError));
                }
            }
        }
Example #17
0
 public BlobData getBlobData()
 {
     if (blobData == null)
         blobData = worldManager.getLevelData ().getFirstBlob ();
     return blobData;
 }
Example #18
0
    internal static pxcmStatus QueryBlobDataINT(IntPtr instance, Int32 index, IntPtr segmentationImage, out BlobData blobData)
    {
        blobData = new BlobData();

        return(PXCMBlobExtractor_QueryBlobData(instance, index, segmentationImage, blobData));
    }
Example #19
0
        private void FillDoc(DocumentBuilder builder, string prefix, DynaDoc doc)
        {
            var pref = String.IsNullOrEmpty(prefix) ? "" : prefix + ".";

            //foreach (var attr in doc.Doc.Attributes)
            //{
            //    var fn = Logger.GetLogFileName("ReportManagerError");
            //    Logger.OutputLog(fn, "ERROR BLOB: " + attr.AttrDef.Name + " ----- " + attr.GetType() + " ----- " + attr.ObjectValue.ToString().Length + " ----- " + (attr is BlobAttribute));
            //}

            foreach (var attr in doc.Doc.Attributes)
            {
                var value = attr.ObjectValue;

                try
                {
                    if (attr is BlobAttribute)
                    {
                        //var fn = Logger.GetLogFileName("ReportManagerError");
                        //Logger.OutputLog(fn, "ERROR BLOB: " + attr.AttrDef.Name + " ----- " + attr.GetType());

                        IDocRepository _docRepo = Provider.Get <IDocRepository>();

                        BlobData img = _docRepo.GetBlobAttrData(doc.Doc.Id, attr.AttrDef);

                        //Logger.OutputLog(fn, "ERROR BLOB: " + img.FileName);

                        // We assume only Image types blobs are used in reports
                        builder.SetBlobField(pref + attr.AttrDef.Name, img.Data);

                        continue;
                    }
                }
                catch (Exception e)
                {
                    var fn = Logger.GetLogFileName("ReportManagerError");
                    Logger.OutputLog(fn, e, e.Message);
                }

                if (value == null)
                {
                    continue;
                }

                if (attr is DocAttribute)
                {
                    var attrDoc = doc.GetAttrDoc((DocAttribute)attr);

                    if (attrDoc != null)
                    {
                        using (var dynaDoc = new DynaDoc(attrDoc, UserId, Provider))
                            FillDoc(builder, pref + attr.AttrDef.Name, dynaDoc);
                    }
                }
                else if (attr is DocListAttribute)
                {
                    var index = 0;
                    foreach (var docItem in doc.GetAttrDocList((DocListAttribute)attr))
                    {
                        using (var dynaDoc = new DynaDoc(docItem, UserId, Provider))
                            FillDoc(builder, string.Format("{0}{1}.{2}", pref, attr.AttrDef.Name, index), dynaDoc);
                        index++;
                    }
                }
                else if (attr is EnumAttribute)
                {
                    var enumValue = doc.GetAttrEnum((EnumAttribute)attr);

                    if (enumValue != null)
                    {
                        builder.SetField(pref + attr.AttrDef.Name, enumValue.Value);
                    }
                }
                else if (attr is DateTimeAttribute)
                {
                    builder.SetField(pref + attr.AttrDef.Name, String.Format("{0:d}", value));
                }
                else if (attr is CurrencyAttribute || attr is FloatAttribute)
                {
                    builder.SetField(pref + attr.AttrDef.Name, String.Format("{0:F2}", value));
                }
                else
                {
                    builder.SetField(pref + attr.AttrDef.Name, value);
                }
            }
        }
Example #20
0
 public void TestStructContainingArray() {
     BlobData arg = new BlobData();
     arg.ident = 1;
     arg.data = new int[] { 1, 2, 3 };
     BlobData result = m_testService.EchoBlobData(arg);    
     Assert.AreEqual(arg.ident, result.ident);
     Assert.AreEqual(arg.data.Length, result.data.Length);
     for (int i = 0; i < arg.data.Length; i++) {
         Assert.AreEqual(arg.data[i], result.data[i]);
     }            
 }
        async Task <object> IDataStore.AddOrReplaceAsync(BlobData blob, CancellationToken cancellationToken)
        {
            ArgCheck.NotNull(nameof(blob), blob);

            return((await PutAsync(blob?.Key, blob?.Content, directoryRelativeAddress: blob?.Partition, contentType: blob?.ContentType, contentEncoding: blob?.ContentEncoding, ifMatchETag: (string)blob?.ConcurrencyToken, absoluteExpiration: blob?.ExpiresAt, cancellationToken: cancellationToken).ConfigureAwait(false))?.ETag);
        }
        internal static pxcmStatus QueryBlobDataINT(IntPtr instance, Int32 index, IntPtr segmentationImage, out BlobData blobData)
        {
            blobData = new BlobData();

            return PXCMBlobExtractor_QueryBlobData(instance, index, segmentationImage, blobData);
        }
Example #23
0
    private int getDriftFuel(BlobData blobData)
    {
        /*
        if the blob spawns, and misses the main platform, this is the total distance
        it will cover before disappearing off the other side of the map.
        */
        BlobManager mainBlob = getBlob (mainBlobName);
        IntVector3 vec = blobData.getMoveDirectionUnitVector ();

        int fuel = GameSettings.blobSpawnDistance * 2;
        fuel += mainBlob.getPrism ().width * Mathf.Abs (vec.x);
        fuel += mainBlob.getPrism ().height * Mathf.Abs (vec.y);
        fuel += mainBlob.getPrism ().depth * Mathf.Abs (vec.z);

        return fuel;
    }
 /**
  *  @brief Retrieve the 2D image mask of the blob and its associated blob data
  *  The blobs are ordered from the largest to the smallest (in number of pixels)
  *  @see BlobData
  *  @param[in] index the zero-based index of the requested blob (has to be between 0 to number of blobs)
  *  @param[out] segmentationImage the 2D image mask of the requested blob
  *  @param[out] blobData the data of the requested blob
  *  @return PXCM_STATUS_NO_ERROR if index is valid and processImage terminated successfully; otherwise, return the following error:
  *  PXCM_STATUS_PARAM_UNSUPPORTED if index is invalid or PXCM_STATUS_ITEM_UNAVAILABLE if processImage is running or PXCMBlobExtractor was not initialized.
  */
 public pxcmStatus QueryBlobData(Int32 index, PXCMImage segmentationImage, out BlobData blobData)
 {
     return(QueryBlobDataINT(instance, index, segmentationImage.instance, out blobData));
 }
        public async Task <string> PostBlobData2(BlobData blobData)
        {
            try
            {
                SqlConnection conn    = null;
                SqlCommand    command = null;

                var connectionString = string.Empty;
                var json             = string.Empty;
                connectionString = ConfigurationManager.AppSettings["ConnectionString"];

                conn    = new SqlConnection(connectionString);
                command = new SqlCommand("BlobStorageIns2", conn);
                command.CommandTimeout = 0;

                command.CommandType = CommandType.StoredProcedure;
                conn.Open();

                command.Parameters.Add("@filePath", SqlDbType.VarChar, 255);
                command.Parameters.Add("@fileExt", SqlDbType.VarChar, 10);
                command.Parameters.Add("@senderNumber", SqlDbType.VarChar, 30);
                command.Parameters.Add("@senderLat", SqlDbType.Decimal);
                command.Parameters.Add("@senderLong", SqlDbType.Decimal);
                command.Parameters.Add("@adminArea", SqlDbType.VarChar, 50);
                command.Parameters.Add("@countryCode", SqlDbType.VarChar, 50);
                command.Parameters.Add("@countryName", SqlDbType.VarChar, 50);
                command.Parameters.Add("@featureName", SqlDbType.VarChar, 50);
                command.Parameters.Add("@locality", SqlDbType.VarChar, 50);
                command.Parameters.Add("@postalCode", SqlDbType.VarChar, 50);
                command.Parameters.Add("@subAdminArea", SqlDbType.VarChar, 50);
                command.Parameters.Add("@subLocality", SqlDbType.VarChar, 50);
                command.Parameters.Add("@subThoroughFare", SqlDbType.VarChar, 50);
                command.Parameters.Add("@thoroughFare", SqlDbType.VarChar, 50);
                command.Parameters.Add("@createdOn", SqlDbType.DateTime);

                command.Parameters["@filePath"].Value        = blobData.filePath;
                command.Parameters["@fileExt"].Value         = blobData.fileExt;
                command.Parameters["@senderNumber"].Value    = blobData.senderNumber;
                command.Parameters["@senderLat"].Value       = blobData.senderLat;
                command.Parameters["@senderLong"].Value      = blobData.senderLong;
                command.Parameters["@adminArea"].Value       = blobData.adminArea;
                command.Parameters["@countryCode"].Value     = blobData.countryCode;
                command.Parameters["@countryName"].Value     = blobData.countryName;
                command.Parameters["@featureName"].Value     = blobData.featureName;
                command.Parameters["@locality"].Value        = blobData.locality;
                command.Parameters["@postalCode"].Value      = blobData.postalCode;
                command.Parameters["@subAdminArea"].Value    = blobData.subAdminArea;
                command.Parameters["@subLocality"].Value     = blobData.subLocality;
                command.Parameters["@subThoroughFare"].Value = blobData.subThoroughFare;
                command.Parameters["@thoroughFare"].Value    = blobData.thoroughFare;
                command.Parameters["@createdOn"].Value       = DateTime.UtcNow;

                command.ExecuteNonQuery();

                conn.Close();
                conn.Dispose();

                HttpResponseMessage response = Request.CreateResponse <BlobData>(HttpStatusCode.Created, blobData);
                return(response.StatusCode.ToString());
            }
            catch (Exception exception)
            {
                return(exception.Message);
            }
        }
Example #26
0
 private static extern pxcmStatus PXCMBlobExtractor_QueryBlobData(IntPtr instance, Int32 index, IntPtr segmentationImage, [Out] BlobData blobData);
Example #27
0
    private IntVector3 getBlobStartPosition(BlobData blobData)
    {
        Prism mainPrism = getBlob (mainBlobName).genPrism ();
        IntVector3 vec = blobData.getMoveDirectionUnitVector ();
        IntVector3 pos = new IntVector3 (mainPrism.x, mainPrism.y, mainPrism.z);

        int xOffset = blobData.offset.x;
        int yOffset = blobData.offset.y;

        if (blobData.offset.guarenteeHit) {

            IntVector3 moveDirection = blobData.getMoveDirectionUnitVector ();
            IntVector2 blobOffset = MDCollision.getCenterCollisionPoint (blobData.getMapData (), moveDirection);

            IntVector2 preferredPoint = new IntVector2 (xOffset, yOffset);
            int[,,] mainMapData = ((BlobManager)getBlob (mainBlobName)).mapData;
            IntVector2 mainOffset = MDCollision.getCollisionPoint (mainMapData, preferredPoint, moveDirection);

            xOffset = mainOffset.x - blobOffset.x;
            yOffset = mainOffset.y - blobOffset.y;
        }

        IntVector3 sizeVector = blobData.getSizeVector ();
        int nextOffset = xOffset;
        if (vec.x == 0) {
            pos.x += nextOffset;
            nextOffset = yOffset;
        } else {
            pos.x += vec.x * GameSettings.blobSpawnDistance * -1;
            if (vec.x == 1)
                pos.x -= sizeVector.x;
            if (vec.x == -1)
                pos.x += mainPrism.width;
        }

        if (vec.z == 0) {
            pos.z += nextOffset;
            nextOffset = yOffset;
        } else {
            pos.z += vec.z * GameSettings.blobSpawnDistance * -1;
            if (vec.z == 1)
                pos.z -= sizeVector.z;
            if (vec.z == -1)
                pos.z += mainPrism.depth;
        }

        if (vec.y == 0) {
            pos.y += nextOffset;
        } else {
            pos.y += vec.y * GameSettings.blobSpawnDistance * -1;
            if (vec.y == 1)
                pos.y -= sizeVector.y;
            if (vec.y == -1)
                pos.y += mainPrism.height;
        }
        return pos;
    }
Example #28
0
 void Awake()
 {
     my_bd = GetComponent <BlobData>();
 }
 /**
     @brief Retrieve the 2D image mask of the blob and its associated blob data
     The blobs are ordered from the largest to the smallest (in number of pixels)
     @see BlobData
     @param[in] index the zero-based index of the requested blob (has to be between 0 to number of blobs) 
     @param[out] segmentationImage the 2D image mask of the requested blob
     @param[out] blobData the data of the requested blob
     @return PXCM_STATUS_NO_ERROR if index is valid and processImage terminated successfully; otherwise, return the following error:
     PXCM_STATUS_PARAM_UNSUPPORTED if index is invalid or PXCM_STATUS_ITEM_UNAVAILABLE if processImage is running or PXCMBlobExtractor was not initialized.
 */
 public pxcmStatus QueryBlobData(Int32 index, PXCMImage segmentationImage, out BlobData blobData)
 {
     return QueryBlobDataINT(instance, index, segmentationImage.instance, out blobData);
 }
Example #30
0
 void Start()
 {
     rb    = GetComponent <Rigidbody2D>();
     my_bd = GetComponent <BlobData>();
 }