public void RemoveObject(SelectableObject obj)
 {
     if (obj.Id > 0)
     {
         if (!unusedIDs.Contains(obj.Id))
             unusedIDs.Enqueue(obj.Id);
         objectTable.Remove(obj.Id);
     }
 }
        public uint AddObject(SelectableObject obj)
        {
            uint objID;
            if (unusedIDs.Count == 0)
                objID = ++count;
            else
                objID = (uint)unusedIDs.Dequeue();

            obj.SetObjectId(objID);
            objectTable.Add(objID, obj);
            return objID;
        }
예제 #3
0
        public void SetObject(SelectableObject obj)
        {
            // check if this is the first time that the object reference is being set
            if (originObject == null)
            {
                // clearly this is a new touch, set both the origin and current object
                originObject = obj;
                currentObject = originObject;
                currentObject.TouchId = id;
            }

            // check if the touch is over top of a new object
            if (obj != null && obj != currentObject)
            {
                if (currentObject != null)
                {
                    currentObject.TouchId = NO_ID;
                }
                currentObject = obj;
                currentObject.TouchId = id;
            }

            /*
            if (currentObject != null && obj != currentObject)
            {
                // if it's a new object, clear the touchId of the previous currentObject
                currentObject.TouchId = NO_ID;
                currentObject = obj;
                currentObject.TouchId = id;
            }
            //*/
        }
예제 #4
0
 public void ClearObjects()
 {
     if (originObject != null)
     {
         originObject.TouchId = NO_ID;
     }
     if (currentObject != null)
     {
         currentObject.TouchId = NO_ID;
         currentObject = null;
     }
 }
예제 #5
0
 private void HandleTouch(SelectableObject obj)
 {
     if (obj == blobTest2)
     {
         if (blobTest2.CircleRadius == 80)
         {
             timer.Start();
         }
         else
         {
             blobTest2.MiddleRadius = 0;
             blobTest2.CircleRadius = 80;
             blobTest2.SpanAngle = 0;
             blobTest2.Recompute();
         }
     }
 }