The WindZone
script represents an environmental hazard or mechanic that dynamically alters the movement of fire in the game. When the FireEffectMover
enters and remains within the zone, it receives a continuous force in a specified direction (windStrength
). The zone also plays a sound effect on entry to give audio feedback to the player.
This mechanic adds strategic depth, requiring players to consider wind behavior when drawing fuse paths.
WindZone
Namespace: global
Inherits from: MonoBehaviour
Vector2 windStrength
Defines the directional force applied to any fire within the wind zone. Can be set in the Inspector to simulate wind blowing left, right, up, or down.
AudioClip windZoneAudioClip
Optional audio clip played when the fire enters the wind zone.
AudioSource windZoneAudioSource
Audio source used to play the wind effect sound. Automatically assigned via GetComponent<AudioSource>()
.
void Awake()
Initializes internal references. Fetches the AudioSource
component from the current GameObject.
void OnTriggerStay2D(Collider2D other)
Called every frame while a collider remains inside the trigger.
FireEffectMover
component.windStrength
vector to the fire’s movement.
void OnTriggerEnter2D(Collider2D other)
Plays the assigned wind audio clip when a collider first enters the zone.
void OnTriggerExit2D(Collider2D other)
Logs the exit of the fire object from the wind zone. Currently used for debugging or visual feedback.
GameObject
with a 2D collider set as a trigger.AudioSource
component.windStrength
in the Inspector (e.g., (1, 0)
for rightward wind).windZoneAudioClip
.// Example wind force
windStrength = new Vector2(-0.5f, 0f); // Pushes fire left
windStrength
carefully to avoid excessive push force, which could overpower burn pathing.OnTriggerExit2D
for potential future logic like removing wind influence or playing fade-out sounds.