Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
quick:program [2018/05/18 21:30] – pedro | quick:program [2020/09/03 09:14] – pedro | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | < | ||
# Programmers Quick Start Guide | # Programmers Quick Start Guide | ||
Line 16: | Line 17: | ||
- | {{ : | + | ![](: |
If you play that scene, you may have noticed that if the `Enemy` reaches the player, he keeps joined to him and slowly orbitating. This is not, surely enough, a nice behavior for a frightening enemy. We would want our enemy to stop moving and shoot the player when the distance between them reaches a threshold. We will do that adding a new child behavior to the priority selector but we need the `Shoot` action in the first place. | If you play that scene, you may have noticed that if the `Enemy` reaches the player, he keeps joined to him and slowly orbitating. This is not, surely enough, a nice behavior for a frightening enemy. We would want our enemy to stop moving and shoot the player when the distance between them reaches a threshold. We will do that adding a new child behavior to the priority selector but we need the `Shoot` action in the first place. | ||
Line 35: | Line 36: | ||
- The class _must have_ an `Action` attribute that determines the name the action will have in the editor. This disconnects the class name and that one shown in the action collection within BB editor, allowing even hierarchical names in a similar way as Unity allows for the shader assets. | - The class _must have_ an `Action` attribute that determines the name the action will have in the editor. This disconnects the class name and that one shown in the action collection within BB editor, allowing even hierarchical names in a similar way as Unity allows for the shader assets. | ||
- The class _could have_ a `Help` attribute with an action description that will be shown in the editor. | - The class _could have_ a `Help` attribute with an action description that will be shown in the editor. | ||
- | - The class attributes (or properties) that should be available as action parameters in the editor _must have_ an `InParam` attribute, specifying the visible name. This allows you both to use even private attributes as editor parameters, and to specify editor names with characters that would be invalid for a C# identifier (such as spaces). Optionally, when the attribute has a basic type, a default value can also be set. | + | - The class attributes (or properties) that should be available as action parameters in the editor _must have_ an `InParam` attribute, specifying the visible name. This allows you both to use even private attributes as editor parameters, and to specify editor names with characters that would be invalid for a C# identifier (such as spaces). Optionally, when the attribute has a basic type, a default value can also be set. `Setting a default value by code does not work in some Unity versions, so maybe you will have to set the value in the editor`. |
Please note the name difference between the Behavior Bricks `OnUpdate()` method and the common `MonoBehavior:: | Please note the name difference between the Behavior Bricks `OnUpdate()` method and the common `MonoBehavior:: | ||
Line 104: | Line 105: | ||
- Create a new node in the canvas for the `ShootOnce` action. Note the action parameters in the inspector and, specifically, | - Create a new node in the canvas for the `ShootOnce` action. Note the action parameters in the inspector and, specifically, | ||
- | {{ : | + | ![]( : |
- We want the shooting parameters to be available in the inspector of those game objects that use the behavior. Select _blackboard_ for all the three input parameters, and create a new field for each one. Use the default names except for `velocity`, where something like `bulletVelocity` is preferred to avoid confusion. | - We want the shooting parameters to be available in the inspector of those game objects that use the behavior. Select _blackboard_ for all the three input parameters, and create a new field for each one. Use the default names except for `velocity`, where something like `bulletVelocity` is preferred to avoid confusion. | ||
Line 730: | Line 731: | ||
--> | --> | ||
+ | |||
+ | </ |