|
| void | Update () |
| | Update every per frame. Only function in here is the DistanceToLookAt. More...
|
| |
| void | OnCollisionEnter (Collision collision) |
| | When there is a collision detected by the player bullet, the enemy's life will go down. If down to 3, the enemy is dead. More...
|
| |
| void | DistanceToLookAt () |
| | Determine a function of how far the enemy looks at the player (distance), and when to shoot at the player. More...
|
| |
| void | lookAtPlayer () |
| | Extensive math problem here ti determine the player position and enemy position. More...
|
| |
| void | FireAtPlayer () |
| | Fire at the player More...
|
| |
◆ DistanceToLookAt()
| void EnemyAI.DistanceToLookAt |
( |
| ) |
|
|
private |
Determine a function of how far the enemy looks at the player (distance), and when to shoot at the player.
- Pseudo Code
- If the player is within looking distance, I will look at him wherever the player is.
- If the player steps into my danger zone, I am allowed to fire
- Parameters
-
| timer | Incremental for time.deltatime |
| playerDistance | Vector3.Distance |
- Returns
- Returns if I'm within the distance to look at the player
Definition at line 82 of file EnemyAI.cs.
◆ FireAtPlayer()
| void EnemyAI.FireAtPlayer |
( |
| ) |
|
|
private |
Fire at the player
- Pseudo Code
- An object will be created with some velocity and will be destroyed at a certain amount of time.
- Parameters
-
| BulletInstance | Create the bullet instance using the prefab stuff |
| launch | Get the bullet instance/param> - Parameters
-
| velocity | Part of launch to determine the bullet speed |
- Returns
- Fire at the player
|
Definition at line 128 of file EnemyAI.cs.
◆ lookAtPlayer()
| void EnemyAI.lookAtPlayer |
( |
| ) |
|
|
private |
Extensive math problem here ti determine the player position and enemy position.
- Pseudo Code
- I will rotate using Quaternion to look at the player position
- Returns
- Rotation
Definition at line 111 of file EnemyAI.cs.
◆ OnCollisionEnter()
| void EnemyAI.OnCollisionEnter |
( |
Collision |
collision | ) |
|
|
private |
When there is a collision detected by the player bullet, the enemy's life will go down. If down to 3, the enemy is dead.
- Pseudo Code
- Did I get hit by the player's bullet?
- If so, I lose a hit point
- Did I lose all 3 lives?
- If so, destroy object
- Parameters
-
| currentHealth | Enemy Health Variable |
- Returns
- Return if there is something collided with enemy and player's bullet
Definition at line 55 of file EnemyAI.cs.
◆ Update()
Update every per frame. Only function in here is the DistanceToLookAt.
- Pseudo Code
- Keeps updating the DistanceToLookAt function.
- Returns
- Distance Function
Definition at line 32 of file EnemyAI.cs.
◆ bulletEmitter
| Transform EnemyAI.bulletEmitter |
◆ bulletPrefab
| GameObject EnemyAI.bulletPrefab |
◆ currentHealth
◆ FireFrequency
| float EnemyAI.FireFrequency |
◆ FireSpeed
◆ maxHealth
| const int EnemyAI.maxHealth = 3 |
◆ Player
◆ playerDistance
| float EnemyAI.playerDistance |
◆ rotationDamping
| float EnemyAI.rotationDamping |
◆ target
| RaycastHit EnemyAI.target |
|
private |
◆ timer
The documentation for this class was generated from the following file:
- D:/Google Drive/Unity Projects/Tank Game/Assets/Scripts/EnemyAI.cs