Class Trooper
Troopers who aim to capture the enemy flag and defend their own. They have a Health value and have a blaster to battle the other team with. Walking into either the flag, a HealthPickup or an AmmoPickup will automatically interact with them.
Inherited Members
Namespace: KaijuSolutions.Agents.Exercises.CTF
Syntax
public class Trooper : KaijuController
Fields
OnTrooperHitGlobal
Global callback for one agent hitting another.
Declaration
public static MultiTrooperAction OnTrooperHitGlobal
Field Value
| Type | Description |
|---|---|
| MultiTrooperAction |
Properties
All
All troopers currently active.
Declaration
public static IReadOnlyCollection<Trooper> All { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<Trooper> |
AllOne
All troopers currently active for team one.
Declaration
public static IReadOnlyCollection<Trooper> AllOne { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<Trooper> |
AllTwo
All troopers currently active for team two.
Declaration
public static IReadOnlyCollection<Trooper> AllTwo { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<Trooper> |
Ammo
The ammo for this Trooper's BlasterActuator.
Declaration
public int Ammo { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
CanAttack
If the BlasterActuator has any ammo and is not
Declaration
public bool CanAttack { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
EnemyBase
Get the location of the other team's base.
Declaration
public Vector2 EnemyBase { get; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
EnemyBase3
Get the location of the other team's base.
Declaration
public Vector3 EnemyBase3 { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
FlagPosition
Where to store the flag when picking it up.
Declaration
public Transform FlagPosition { get; }
Property Value
| Type | Description |
|---|---|
| Transform |
HasAmmo
If the BlasterActuator has any ammo.
Declaration
public bool HasAmmo { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Health
The current health of this trooper.
Declaration
public int Health { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
OwnBase
Get the location of this trooper's own base.
Declaration
public Vector2 OwnBase { get; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
OwnBase3
Get the location of this trooper's own base.
Declaration
public Vector3 OwnBase3 { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
TeamOne
What team this trooper is on.
Declaration
public bool TeamOne { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
Attack()
Fire the BlasterActuator.
Declaration
public void Attack()
OnActuatorEnabled(KaijuActuator)
Callback for when an
Declaration
protected override void OnActuatorEnabled(KaijuActuator actuator)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuActuator | actuator | The |
Overrides
Spawn(KaijuAgent, SpawnPoint)
Spawn a trooper.
Declaration
public static Trooper Spawn(KaijuAgent trooperPrefab, SpawnPoint spawnPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | trooperPrefab | The trooper prefab to spawn. |
| SpawnPoint | spawnPoint | The SpawnPoint to spawn the trooper at. |
Returns
| Type | Description |
|---|---|
| Trooper | The spawned trooper. |
StopAttacking()
Cancel trying to fire the BlasterActuator.
Declaration
public void StopAttacking()
TakeDamage(Trooper)
Take damage from another trooper.
Declaration
public void TakeDamage(Trooper attacker)
Parameters
| Type | Name | Description |
|---|---|---|
| Trooper | attacker | The trooper that dealt the damage. |
Events
OnAmmo
Callback for picking up a AmmoPickup.
Declaration
public event AmmoAction OnAmmo
Event Type
| Type | Description |
|---|---|
| AmmoAction |
OnAmmoGlobal
Global callback for picking up a AmmoPickup.
Declaration
public event TrooperAmmoAction OnAmmoGlobal
Event Type
| Type | Description |
|---|---|
| TrooperAmmoAction |
OnEliminatedByTrooper
Callback for getting eliminated by another trooper.
Declaration
public event TrooperAction OnEliminatedByTrooper
Event Type
| Type | Description |
|---|---|
| TrooperAction |
OnEliminatedTrooper
Callback for eliminated another trooper.
Declaration
public event TrooperAction OnEliminatedTrooper
Event Type
| Type | Description |
|---|---|
| TrooperAction |
OnFlagCaptured
Callback for when this agent captured the Flag.
Declaration
public event FlagAction OnFlagCaptured
Event Type
| Type | Description |
|---|---|
| FlagAction |
OnFlagCapturedGlobal
Global callback for when this agent captured the Flag.
Declaration
public event TrooperFlagAction OnFlagCapturedGlobal
Event Type
| Type | Description |
|---|---|
| TrooperFlagAction |
OnFlagDropped
Callback for when this agent dropped the Flag.
Declaration
public event FlagAction OnFlagDropped
Event Type
| Type | Description |
|---|---|
| FlagAction |
OnFlagDroppedGlobal
Global callback for when this agent dropped the Flag.
Declaration
public event TrooperFlagAction OnFlagDroppedGlobal
Event Type
| Type | Description |
|---|---|
| TrooperFlagAction |
OnFlagPickedUp
Callback for when this agent picking up the Flag.
Declaration
public event FlagAction OnFlagPickedUp
Event Type
| Type | Description |
|---|---|
| FlagAction |
OnFlagPickedUpGlobal
Global callback for when this agent picking up the Flag.
Declaration
public event TrooperFlagAction OnFlagPickedUpGlobal
Event Type
| Type | Description |
|---|---|
| TrooperFlagAction |
OnFlagReturned
Callback for when this agent returned the Flag.
Declaration
public event FlagAction OnFlagReturned
Event Type
| Type | Description |
|---|---|
| FlagAction |
OnFlagReturnedGlobal
Global callback for when this agent returned the Flag.
Declaration
public event TrooperFlagAction OnFlagReturnedGlobal
Event Type
| Type | Description |
|---|---|
| TrooperFlagAction |
OnHealth
Callback for picking up a HealthPickup.
Declaration
public event HealthAction OnHealth
Event Type
| Type | Description |
|---|---|
| HealthAction |
OnHealthGlobal
Global callback for picking up a HealthPickup.
Declaration
public event TrooperHealthAction OnHealthGlobal
Event Type
| Type | Description |
|---|---|
| TrooperHealthAction |
OnHitByTrooper
Callback for getting hit by another trooper.
Declaration
public event TrooperAction OnHitByTrooper
Event Type
| Type | Description |
|---|---|
| TrooperAction |
OnHitTrooper
Callback for hitting another trooper.
Declaration
public event TrooperAction OnHitTrooper
Event Type
| Type | Description |
|---|---|
| TrooperAction |
OnTrooperEliminatedGlobal
Global callback for one trooper eliminating another.
Declaration
public static event MultiTrooperAction OnTrooperEliminatedGlobal
Event Type
| Type | Description |
|---|---|
| MultiTrooperAction |