Dong_Minh_Doxygen: EnemyAI Class Reference

Dong Minh

Dong_Minh_Doxygen
Inheritance diagram for EnemyAI:
Inheritance graph
Collaboration diagram for EnemyAI:
Collaboration graph

Public Attributes

Transform Player
 
float playerDistance
 
float rotationDamping
 
GameObject bulletPrefab
 
Transform bulletEmitter
 
float FireSpeed
 
float FireFrequency
 
const int maxHealth = 3
 
int currentHealth = maxHealth
 

Private Member Functions

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...
 

Private Attributes

RaycastHit target
 
float timer = 0
 

Detailed Description

Definition at line 5 of file EnemyAI.cs.

Member Function Documentation

◆ 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
timerIncremental for time.deltatime
playerDistanceVector3.Distance
Returns
Returns if I'm within the distance to look at the player

Definition at line 82 of file EnemyAI.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
BulletInstanceCreate the bullet instance using the prefab stuff
launchGet the bullet instance/param>
Parameters
velocityPart of launch to determine the bullet speed
Returns
Fire at the player

Definition at line 128 of file EnemyAI.cs.

Here is the caller graph for this function:

◆ 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.

Here is the caller graph for this function:

◆ 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
currentHealthEnemy Health Variable
Returns
Return if there is something collided with enemy and player's bullet

Definition at line 55 of file EnemyAI.cs.

◆ Update()

void EnemyAI.Update ( )
private

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.

Here is the call graph for this function:

Member Data Documentation

◆ bulletEmitter

Transform EnemyAI.bulletEmitter

Definition at line 12 of file EnemyAI.cs.

◆ bulletPrefab

GameObject EnemyAI.bulletPrefab

Definition at line 11 of file EnemyAI.cs.

◆ currentHealth

int EnemyAI.currentHealth = maxHealth

Definition at line 20 of file EnemyAI.cs.

◆ FireFrequency

float EnemyAI.FireFrequency

Definition at line 14 of file EnemyAI.cs.

◆ FireSpeed

float EnemyAI.FireSpeed

Definition at line 13 of file EnemyAI.cs.

◆ maxHealth

const int EnemyAI.maxHealth = 3

Definition at line 19 of file EnemyAI.cs.

◆ Player

Transform EnemyAI.Player

Definition at line 7 of file EnemyAI.cs.

◆ playerDistance

float EnemyAI.playerDistance

Definition at line 8 of file EnemyAI.cs.

◆ rotationDamping

float EnemyAI.rotationDamping

Definition at line 9 of file EnemyAI.cs.

◆ target

RaycastHit EnemyAI.target
private

Definition at line 15 of file EnemyAI.cs.

◆ timer

float EnemyAI.timer = 0
private

Definition at line 17 of file EnemyAI.cs.


The documentation for this class was generated from the following file:
  • D:/Google Drive/Unity Projects/Tank Game/Assets/Scripts/EnemyAI.cs
Generated by   doxygen 1.8.13