Merge branch 'Oskar-ML' of https://git.wmi.amu.edu.pl/s425077/PotatoPlan into Oskar-ML
This commit is contained in:
commit
5424c2c66a
@ -142,6 +142,10 @@ class Crops
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cropType == 0)
|
||||
{
|
||||
return 16; //Barley
|
||||
}
|
||||
if (cropType == 1)
|
||||
{
|
||||
return 16; //Barley
|
||||
|
@ -5,11 +5,12 @@ class HandleRotation
|
||||
{
|
||||
int rotationSpeed = 5, Rotation = 180;
|
||||
private float oldSpeed, movementSpeed;
|
||||
private Vector2 oldTile, oldPosition;
|
||||
private Vector2 oldTile, oldPosition, oldMovementSpeed;
|
||||
private Vector2 Direction;
|
||||
|
||||
public Vector2 UpdatePosition(int Destination, float tractorSpeed, Vector2 Position, Crops crops)
|
||||
public Vector2 UpdatePosition(int Destination, float tractorSpeed, Vector2 Position, Crops crops, Vector2 oldDeltaPosition, Vector2 Target)
|
||||
{
|
||||
Vector2 Direction;
|
||||
|
||||
if (oldSpeed != crops.getSpeedFactor(tractorSpeed))
|
||||
{
|
||||
Position = new Vector2((int)Math.Round(Position.X), (int)Math.Round(Position.Y));
|
||||
@ -105,7 +106,11 @@ class HandleRotation
|
||||
|
||||
}
|
||||
oldSpeed = crops.getSpeedFactor(tractorSpeed);
|
||||
oldPosition = Position;
|
||||
if (oldDeltaPosition.X < 1 && oldDeltaPosition.X > -1 && oldDeltaPosition.Y < 1 && oldDeltaPosition.Y > -1)
|
||||
{
|
||||
Position = Target;
|
||||
}
|
||||
oldMovementSpeed = Direction;
|
||||
return Position;
|
||||
}
|
||||
|
||||
|
@ -49,20 +49,20 @@ class Tractor
|
||||
}
|
||||
else if (DeltaPosition.Y > 0)
|
||||
{
|
||||
Position = handleRotation.UpdatePosition(0, tractorSpeed, Position, smartTractor.getFarm().getCrop((int)Math.Round(Position.X / (sizeTile + Spacing)), (int)Math.Round(Position.Y / (sizeTile + Spacing))));
|
||||
Position = handleRotation.UpdatePosition(0, tractorSpeed, Position, smartTractor.getFarm().getCrop((int)Math.Round(Position.X / (sizeTile + Spacing)), (int)Math.Round(Position.Y / (sizeTile + Spacing))), DeltaPosition, TargetPosition);
|
||||
}
|
||||
else if (DeltaPosition.Y < 0)
|
||||
{
|
||||
Position = handleRotation.UpdatePosition(1, tractorSpeed, Position, smartTractor.getFarm().getCrop((int)Math.Round(Position.X / (sizeTile + Spacing)), (int)Math.Round(Position.Y / (sizeTile + Spacing))));
|
||||
Position = handleRotation.UpdatePosition(1, tractorSpeed, Position, smartTractor.getFarm().getCrop((int)Math.Round(Position.X / (sizeTile + Spacing)), (int)Math.Round(Position.Y / (sizeTile + Spacing))), DeltaPosition, TargetPosition);
|
||||
}
|
||||
}
|
||||
else if (DeltaPosition.X > 0)
|
||||
{
|
||||
Position = handleRotation.UpdatePosition(2, tractorSpeed, Position, smartTractor.getFarm().getCrop((int)Math.Round(Position.X / (sizeTile + Spacing)), (int)Math.Round(Position.Y / (sizeTile + Spacing))));
|
||||
Position = handleRotation.UpdatePosition(2, tractorSpeed, Position, smartTractor.getFarm().getCrop((int)Math.Round(Position.X / (sizeTile + Spacing)), (int)Math.Round(Position.Y / (sizeTile + Spacing))), DeltaPosition, TargetPosition);
|
||||
}
|
||||
else if (DeltaPosition.X < 0)
|
||||
{
|
||||
Position = handleRotation.UpdatePosition(3, tractorSpeed, Position, smartTractor.getFarm().getCrop((int)Math.Round(Position.X / (sizeTile + Spacing)), (int)Math.Round(Position.Y / (sizeTile + Spacing))));
|
||||
Position = handleRotation.UpdatePosition(3, tractorSpeed, Position, smartTractor.getFarm().getCrop((int)Math.Round(Position.X / (sizeTile + Spacing)), (int)Math.Round(Position.Y / (sizeTile + Spacing))), DeltaPosition, TargetPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user