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:agents [2020/09/03 09:24] – pedro | quick:agents [2020/09/03 09:39] – pedro | ||
---|---|---|---|
Line 23: | Line 23: | ||
The script `FiredBullet` consists in giving intelligence to the bullet, so it can tell if the it has impacted the player, besides autodestroy passed 2 seconds (or whatever the time indicated by the parameter). Additionally, | The script `FiredBullet` consists in giving intelligence to the bullet, so it can tell if the it has impacted the player, besides autodestroy passed 2 seconds (or whatever the time indicated by the parameter). Additionally, | ||
- | < | + | |
+ | ```csharp | ||
using UnityEngine; | using UnityEngine; | ||
Line 62: | Line 63: | ||
} | } | ||
} | } | ||
- | </ | + | ``` |
The code should be self-explanatory, | The code should be self-explanatory, | ||
Line 72: | Line 73: | ||
The script `EnemyShoot` implements the shooting capacity of the enemy agent. We create a C# script that extends `Monobehaviour` based on the previous script `ShootOnce`. | The script `EnemyShoot` implements the shooting capacity of the enemy agent. We create a C# script that extends `Monobehaviour` based on the previous script `ShootOnce`. | ||
- | < | + | ```csharp |
using UnityEngine; | using UnityEngine; | ||
Line 149: | Line 150: | ||
} | } | ||
} | } | ||
- | </ | + | ``` |
We have to note the following points: | We have to note the following points: | ||
Line 160: | Line 161: | ||
Finally, we create the C# script `EnemyAgent`, | Finally, we create the C# script `EnemyAgent`, | ||
- | < | + | ```csharp |
using UnityEngine; | using UnityEngine; | ||
Line 253: | Line 254: | ||
} | } | ||
} | } | ||
- | </ | + | ``` |
This class has three main methods that are overriden from the `Agent` class. Explaining why this methods have to be overridden and how Agent class works is out of the scope of this guide. The concrete implementation of these methods is described below. | This class has three main methods that are overriden from the `Agent` class. Explaining why this methods have to be overridden and how Agent class works is out of the scope of this guide. The concrete implementation of these methods is described below. |