BroforceObject - alexneargarder/Broforce-Docs GitHub Wiki
Sets the object's world position to the specified coordinates while preserving the current Z position. Updates the internal X and Y fields to match the new transform position.
Parameters:
- Vector3 pos: The new position vector (only X and Y components are used, Z is preserved from current transform)
Virtual method for setting the object's velocity. Base implementation is empty - derived classes should override to implement velocity changes.
Parameters:
- float xi: The horizontal velocity component
- float yi: The vertical velocity component
Updates the internal X and Y coordinate fields directly without modifying the transform position. This method only updates the backing fields for the X and Y properties.
Parameters:
- float x: The new X coordinate value to store
- float y: The new Y coordinate value to store
Convenience method that extracts the X and Y position from a transform and calls SetXY(float, float) to update the internal coordinate fields.
Parameters:
- Transform t: The transform whose position will be used to set the X and Y coordinates
Gets or sets the object's X position coordinate. This property provides access to the private x field which stores the horizontal position.
Gets or sets the object's Y position coordinate. This property provides access to the private y field which stores the vertical position.
Private backing field that stores the object's X coordinate position. Serialized for persistence and accessed through the X property.
The object's horizontal velocity component. Used for physics calculations and movement updates in derived classes.
Private backing field that stores the object's Y coordinate position. Serialized for persistence and accessed through the Y property.
The object's vertical velocity component. Used for physics calculations and movement updates in derived classes.
Attaches another GameObject to this object by adding it to the otherAttachments list. Used by the attachment system to track objects that are connected to this one.
Parameters:
- Transform t: The transform of the GameObject to attach
Virtual method that triggers a bridge crumbling event. The base implementation only invokes the OnCrumbleBridge event if handlers are subscribed. Derived classes can override to add specific crumbling behavior.
Parameters:
- float chance: The probability or intensity of the crumbling effect (unused in base implementation)
Triggers a disturbance event on this object. If the object has a chain anchor, it collapses the chain. Then invokes the OnDisturb event if any handlers are subscribed. Can be called via RPC for network synchronization.
Hides all attached objects by sending them a "Collapse" message and deactivating their GameObjects. Iterates through the otherAttachments list and processes each non-null attachment.
Reference to a ChainAnchor component that can connect this object to chains or ropes. When the object is disturbed, the chain anchor will collapse if present.
Flag indicating whether this object has collapsed or fallen. Used by environmental systems to track the state of destructible or physics-enabled objects.
List of GameObjects that are attached to this object. Used by the attachment system to track and manage connected objects. Initialized as an empty list.
Virtual method called when a player should be forgotten by this object. Base implementation is empty - derived classes override to implement AI behavior changes when players die or disconnect.
Parameters:
- int playerNum: The player number (0-3) that should be forgotten
- bool confuseMooks: If true, mooks should become confused instead of simply forgetting the player
- bool amuseMooks: If true, mooks should laugh at the dead player instead of forgetting them
Calculates the object's health as a percentage of its maximum health. Returns a value between 0 and 1, clamped to prevent invalid percentages.
Returns:
-
float
: The health percentage as a float between 0.0 (dead) and 1.0 (full health)
Checks if the object is still alive based on its health value. Returns true if health is greater than 0, false otherwise.
Returns:
-
bool
: True if the object has health remaining (health > 0), false if dead or destroyed
Flag indicating whether this object has been destroyed. Used to prevent multiple destruction calls and to track object lifecycle state.
The object's current health points. Defaults to 3. When health reaches 0 or below, the object is considered dead as determined by IsAlive().
The object's maximum health capacity used for calculating health percentage. Defaults to -1, which should be set by derived classes to an appropriate value.
When true, prevents this object from being destroyed by normal damage or destruction calls. Used for invincible objects or during special game states.
Reference to a PredabroTarget component used by the Predabro enemy type for targeting logic. Hidden in inspector as it's managed programmatically.