Effect Of Weather On The Unit Movement - UQdeco2800/2022-studio-3 GitHub Wiki
Overview
Changing the movement speed for the unit according to the weather that is represent in Weather Effect Visual Representation.
Usage
Edit these variable to change the movement speed of the unit arcoding to the weather. It is exists in WeatherIcon
. The value below are exaggerated at the moment.
private final float[] movementSpeedFactor = {
1.5f,
0.5f,
0.4f,
2f,
0.6f
};
There are some slight addition on the PhysicsMovementComponent
about the change of the velocity of the movement according to the weather. It will update the value of it with the multiplication from the movementSpeedFactor
above.
public void changeSpeed(float factor) {
float newSpeed = this.speed * factor;
this.vel = new Vector2(newSpeed, newSpeed);
}
You can try to access the code using the listener function on your code. For now, the trigger to change the movement speed exists on WeatherIconDisplay
on Update()
function.