FCV Engine 0.1
A tool and framework for tutorials in game development
Loading...
Searching...
No Matches
PressureButton Class Reference

Represents a pressure-sensitive button that activates when an object stands on it for a specified duration. Supports optional bounce-back functionality when the object leaves before full activation. Fires events when fully activated and during intermediate states for animations. More...

Inheritance diagram for PressureButton:

Private Member Functions

void Update ()
 Handles bounce-back behavior, gradually resetting the button's state when not fully activated and no object is standing on it. Only applicable if bounceBack is enabled.
 
void OnTriggerExit2D (Collider2D other)
 Detects when an object leaves the button's trigger area. Updates the standing state and stops activation if conditions are met.
 
void OnTriggerEnter2D (Collider2D other)
 Detects when an object enters the button's trigger area. Sets the standing state and prepares for activation.
 
void OnTriggerStay2D (Collider2D other)
 Handles the activation process while an object stays on the button. Gradually increases the activation state and fires the buttonFired event when fully activated.
 
void AnimateOffset (float percentile)
 Handles bounce-back behavior, gradually resetting the button's state when not fully activated and no object is standing on it. Only applicable if bounceBack is enabled.
 

Detailed Description

Represents a pressure-sensitive button that activates when an object stands on it for a specified duration. Supports optional bounce-back functionality when the object leaves before full activation. Fires events when fully activated and during intermediate states for animations.

Definition at line 11 of file PressureButton.cs.

Member Function Documentation

◆ OnTriggerEnter2D()

void OnTriggerEnter2D ( Collider2D other)
private

Detects when an object enters the button's trigger area. Sets the standing state and prepares for activation.

Parameters
otherThe collider that entered the trigger.

Definition at line 65 of file PressureButton.cs.

◆ OnTriggerExit2D()

void OnTriggerExit2D ( Collider2D other)
private

Detects when an object leaves the button's trigger area. Updates the standing state and stops activation if conditions are met.

Parameters
otherThe collider that exited the trigger.

Definition at line 54 of file PressureButton.cs.

◆ OnTriggerStay2D()

void OnTriggerStay2D ( Collider2D other)
private

Handles the activation process while an object stays on the button. Gradually increases the activation state and fires the buttonFired event when fully activated.

Parameters
otherThe collider that stays within the trigger.

Definition at line 76 of file PressureButton.cs.


The documentation for this class was generated from the following file: