public void RemoveBlob(Blob blob) { lock (SynchronizationLock) { _addedBlobs.Remove(blob); _updatedBlobs.Remove(blob); _removedBlobs.Add(blob); } }
public void AddBlob(Blob blob) { lock (SynchronizationLock) { if (_removedBlobs.Contains(blob)) { return; } _updatedBlobs.Remove(blob); _addedBlobs.Add(blob); } }
internal virtual bool OnCollision(Blob otherBlob) { return false; }
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; }
public void RemoveBlob(Blob blob) { lock (BlobsListLock) { blob.OnRemove(); _blobs.Remove(blob); } }
public void AddBlob(Blob blob) { lock (BlobsListLock) { blob.OnCreate(); _blobs.Add(blob); } }