public bool Update(Vector2[][] paths)
{
UpdateDebuffs();
Vector2[] ourPath = paths[_path];
int moveDistance = this.Stats[CreepStats.Speed];
DistanceTravelled += moveDistance;
if (Math.Abs(this.CenterPosition.X - ourPath[this._nextWaypoint].X) > moveDistance)
{
if (ourPath[this._nextWaypoint].X > this.CenterPosition.X)
{
this.CenterPosition.X += moveDistance;
this.Rotation = 0;
}
else if (ourPath[this._nextWaypoint].X < this.CenterPosition.X)
{
this.CenterPosition.X -= moveDistance;
this.Rotation = 180;
}
}
else if (Math.Abs(this.CenterPosition.Y - ourPath[this._nextWaypoint].Y) > moveDistance)
{
if (ourPath[this._nextWaypoint].Y > this.CenterPosition.Y)
{
this.CenterPosition.Y += moveDistance;
this.Rotation = 90;
}
else if (ourPath[this._nextWaypoint].Y < this.CenterPosition.Y)
{
this.CenterPosition.Y -= moveDistance;
this.Rotation = 270;
}
}
else
{
this.CenterPosition.X = ourPath[this._nextWaypoint].X;
this.CenterPosition.Y = ourPath[this._nextWaypoint].Y;
this._nextWaypoint++;
if (ourPath.Length == this._nextWaypoint)
{
// We have reached the end.
return true;
}
}
return false;
}