This shows you the differences between two versions of the page.
|
pjv:laboratoare:2024:a02 [2024/10/21 13:38] alexandru.gradinaru |
pjv:laboratoare:2024:a02 [2024/10/23 08:45] (current) maria_anca.balutoiu [Sisteme de evenimente] |
||
|---|---|---|---|
| Line 47: | Line 47: | ||
| * Inamicii realizeaza actiuni random | * Inamicii realizeaza actiuni random | ||
| - | Pentru simplitate, toate interactiunile se pot realiza prin butoane de comanda. | + | Pentru simplitate, toate interactiunile se pot realiza prin butoane de comanda, dar este necesar sa folositi un sistem de evenimente pentru decuplarea responsabilitatilor (la alegere). |
| Bonusuri: | Bonusuri: | ||
| Line 248: | Line 248: | ||
| | | ||
| // Unsubscribe from the event (stop listening). | // Unsubscribe from the event (stop listening). | ||
| - | private void OnDisable() => player.OnPlayerHealthChanged += HandlePlayerHealthChanged; | + | private void OnDisable() => player.OnPlayerHealthChanged -= HandlePlayerHealthChanged; |
| // Method which is called on event invocation | // Method which is called on event invocation | ||
| Line 317: | Line 317: | ||
| fileName = "PlayerEventSO", | fileName = "PlayerEventSO", | ||
| menuName = "Player/PlayerEventSO")] | menuName = "Player/PlayerEventSO")] | ||
| - | public class PlayerEventSO : MonoBehaviour | + | public class PlayerEventSO : ScriptableObject |
| { | { | ||
| // Unity event. | // Unity event. | ||