This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_lookedat [2020/05/24 15:01] – created dragonlord | dragengine:modules:dragonscript:behavior_lookedat [2025/03/13 17:14] (current) – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 19: | Line 19: | ||
====== Element Class Properties ====== | ====== Element Class Properties ====== | ||
- | Element class properties have the prefix **lookedAt.**. | ||
- | This behavior defines no element | + | Element |
====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
+ | |||
This behavior does not required other behaviors to be present. | This behavior does not required other behaviors to be present. | ||
====== Optional Behaviors ====== | ====== Optional Behaviors ====== | ||
+ | |||
This behavior does not support optional behaviors. | This behavior does not support optional behaviors. | ||
====== Persistency ====== | ====== Persistency ====== | ||
- | This behavior does support element class to be persistable (setPersistable). Saves the list of actors looking at the element. | + | |
+ | This behavior does support element class to be persistable (setPersistable). | ||
====== Events ====== | ====== Events ====== | ||
+ | |||
This behavior supports adding listeners. These events can be received: | This behavior supports adding listeners. These events can be received: | ||
- | * actorStartsLookingAt: Actors starts | + | |
- | | + | ===== actorStartsLookingAt |
+ | |||
+ | Actors starts looking at object. | ||
+ | |||
+ | ===== actorStopsLookingAt | ||
+ | |||
+ | Actors stops looking at object. | ||
====== API Documentation ====== | ====== API Documentation ====== | ||
- | [[https:// | ||
- | Since DragonScript Module Version | + | # |
+ | |||
+ | Since DragonScript Module Version | ||
====== Use Cases ====== | ====== Use Cases ====== | ||
+ | |||
* Show outline and interact prompts if player looks at object. | * Show outline and interact prompts if player looks at object. | ||
* For NPCs to react to player (or other actors) looking at them (for example looking back at player). | * For NPCs to react to player (or other actors) looking at them (for example looking back at player). | ||
Line 61: | Line 72: | ||
end | end | ||
</ | </ | ||
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||
+ | <string name=' | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Live Examples ====== | ||
+ | |||
+ | * [[https:// | ||
+ |