Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 41 additions & 17 deletions Intersect.Client.Core/Maps/WeatherParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,34 @@

namespace Intersect.Client.Maps;


public partial class WeatherParticle : IWeatherParticle
public partial class WeatherParticle : IWeatherParticle, IDisposable
{
private readonly List<IWeatherParticle> _RemoveParticle;

private List<IWeatherParticle> _RemoveParticle;
private readonly Animation animInstance;

private Animation animInstance;
private readonly Rectangle bounds;

private Rectangle bounds;
private readonly float cameraSpawnX;

private float cameraSpawnX;
private readonly float cameraSpawnY;

private float cameraSpawnY;
private readonly int originalX;

private int originalX;
private readonly int originalY;

private int originalY;
private readonly Point partSize;

private Point partSize;
private readonly long TransmittionTimer;

private long TransmittionTimer;
private readonly int xVelocity;

public float X { get; set; }
private readonly int yVelocity;

private int xVelocity;
public float X { get; set; }

public float Y { get; set; }

private int yVelocity;

public WeatherParticle(List<IWeatherParticle> RemoveParticle, int xvelocity, int yvelocity, AnimationDescriptor anim)
{
TransmittionTimer = Timing.Global.MillisecondsUtc;
Expand Down Expand Up @@ -136,6 +134,10 @@ public void Update()

if (!newBounds.IntersectsWith(new Rectangle((int)X, (int)Y, partSize.X, partSize.Y)))
{
if (_RemoveParticle.Contains(this))
{
throw new Exception();
}
_RemoveParticle.Add(this);
}
else
Expand All @@ -150,12 +152,34 @@ public void Update()

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

private void Dispose(bool disposing)
{
ReleaseUnmanagedResources();

if (!disposing)
{
return;
}

animInstance.Dispose();
ReleaseManagedResources();
}

~WeatherParticle()
protected virtual void ReleaseManagedResources()
{
}

protected virtual void ReleaseUnmanagedResources()
{
Dispose();
// TODO release unmanaged resources here
}

~WeatherParticle()
{
Dispose(false);
}
}
Loading