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

                _updatedBlobs.Remove(blob);
                _addedBlobs.Add(blob);
            }
        }
예제 #3
0
파일: Blob.cs 프로젝트: kfazi/AgarIo
 internal virtual bool OnCollision(Blob otherBlob)
 {
     return false;
 }
예제 #4
0
파일: PlayerBlob.cs 프로젝트: kfazi/AgarIo
        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;
        }
예제 #5
0
파일: Game.cs 프로젝트: kfazi/AgarIo
 public void RemoveBlob(Blob blob)
 {
     lock (BlobsListLock)
     {
         blob.OnRemove();
         _blobs.Remove(blob);
     }
 }
예제 #6
0
파일: Game.cs 프로젝트: kfazi/AgarIo
 public void AddBlob(Blob blob)
 {
     lock (BlobsListLock)
     {
         blob.OnCreate();
         _blobs.Add(blob);
     }
 }