Enemy
Table of Contents
- $enemies : array<string|int, mixed>
- List of enemies.
- $enemyTargeted : array<string|int, mixed>
- Data of targed enemy.
- $target : int
- Enemy target (value is key in array of enemies).
- addEnemy() : self
- Add one new enemy to list.
- getEnemies() : array<string|int, mixed>
- Get list of enemies.
- getEnemiesCount() : int
- Count enemies targets.
- getTarget() : int
- Get enemy target.
- setTarget() : self
- Set enemy target.
- setEnemies() : self
- Set enemies (replace previous).
- validateTarget() : int
- Check if target is a valid enemy.
Properties
$enemies
List of enemies.
private
array<string|int, mixed>
$enemies
= []
$enemyTargeted
Data of targed enemy.
private
array<string|int, mixed>
$enemyTargeted
$target
Enemy target (value is key in array of enemies).
private
int
$target
= 0
Methods
addEnemy()
Add one new enemy to list.
public
addEnemy(array<string|int, mixed> $enemy) : self
Parameters
- $enemy : array<string|int, mixed>
Return values
self —getEnemies()
Get list of enemies.
public
getEnemies() : array<string|int, mixed>
Return values
array<string|int, mixed> —getEnemiesCount()
Count enemies targets.
public
getEnemiesCount() : int
Return values
int —getTarget()
Get enemy target.
public
getTarget() : int
Return values
int —setTarget()
Set enemy target.
public
setTarget(int $target) : self
Parameters
- $target : int
Return values
self —setEnemies()
Set enemies (replace previous).
protected
setEnemies(array<string|int, mixed> $enemies) : self
Parameters
- $enemies : array<string|int, mixed>
Return values
self —validateTarget()
Check if target is a valid enemy.
protected
validateTarget(int $target) : int
Parameters
- $target : int