Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: HearingSenseComponent

[22:7] extends: Component

Wraps FXGL's HearingSenseComponent (com.almasb.fxgl.ai.senseai.HearingSenseComponent), a per- entity AI sense that converts incoming noise events into a SenseAIState (CALM / ALERT / AGGRESSIVE). The entity's state rises with each call to hearNoise (scaled by distance and the current state's calm factor) and decays each tick by alertnessDecay. Configurable tunables: hearingRadius, alertnessDecay, noiseVolumeTolerance, calmFactor, alertStateThreshold, aggressiveStateThreshold.

Methods

  • HearingSenseComponent (double HearingRadius = 100.0)

    Creates a new HearingSenseComponent.

    • @p HearingRadius is the maximum distance at which noise will be considered.
  • adopt (object Ajo)

    Wraps an existing HearingSenseComponent AussomJavaObject.

  • getHearingRadius ()

  • setHearingRadius (double V)

  • getAlertnessDecay ()

  • setAlertnessDecay (double V)

  • getNoiseVolumeTolerance ()

  • setNoiseVolumeTolerance (double V)

  • getCalmFactor ()

  • setCalmFactor (double V)

  • getAlertStateThreshold ()

  • setAlertStateThreshold (double V)

  • getAggressiveStateThreshold ()

  • setAggressiveStateThreshold (double V)

  • getLastHeardPoint ()

    Returns the last-heard Point2D AJO (world coordinates).

  • setLastHeardPoint (object PointAjo)

  • getState ()

    Returns the current SenseAIState enum AJO.

  • setState (object StateAjo)

  • stateProperty ()

    Returns the SimpleObjectProperty for binding.

  • hearNoise (object PointAjo, double Volume)

    Notifies this component that a noise was heard at the given world point with the given volume.

    • @p PointAjo is a Point2D AJO.
    • @p Volume is the source volume; it diminishes by distance.
  • alertnessDecay (double V)

    Fluent setter for alertnessDecay. Returns this for chaining.

  • noiseVolumeTolerance (double V)

    Fluent setter for noiseVolumeTolerance.

  • calmFactor (double V)

    Fluent setter for calmFactor.

  • alertStateThreshold (double V)

    Fluent setter for alertStateThreshold.

  • aggressiveStateThreshold (double V)

    Fluent setter for aggressiveStateThreshold.

  • lastHeardPoint (object PointAjo)

    Fluent setter for lastHeardPoint.