Exemple #1
0
 public void RemoveBlob(Blob blob)
 {
     lock (SynchronizationLock)
     {
         _addedBlobs.Remove(blob);
         _updatedBlobs.Remove(blob);
         _removedBlobs.Add(blob);
     }
 }
Exemple #2
0
        public void AddBlob(Blob blob)
        {
            lock (SynchronizationLock)
            {
                if (_removedBlobs.Contains(blob))
                {
                    return;
                }

                _updatedBlobs.Remove(blob);
                _addedBlobs.Add(blob);
            }
        }
Exemple #3
0
 internal virtual bool OnCollision(Blob otherBlob)
 {
     return false;
 }
Exemple #4
0
        internal override bool OnCollision(Blob otherBlob)
        {
            var foodBlob = otherBlob as FoodBlob;
            if (foodBlob != null)
            {
                TryConsume(foodBlob);
                return false;
            }

            var playerBlob = otherBlob as PlayerBlob;
            if (playerBlob != null)
            {
                if (playerBlob.Owner == Owner)
                {
                    TryMerge(playerBlob);
                    return OwnedBlobsCollides(playerBlob);
                }

                TryConsume(playerBlob);
            }

            return false;
        }
Exemple #5
0
 public void RemoveBlob(Blob blob)
 {
     lock (BlobsListLock)
     {
         blob.OnRemove();
         _blobs.Remove(blob);
     }
 }
Exemple #6
0
 public void AddBlob(Blob blob)
 {
     lock (BlobsListLock)
     {
         blob.OnCreate();
         _blobs.Add(blob);
     }
 }