Class Microbe
Microbes which can mate with and eat each other.
Inherited Members
Namespace: KaijuSolutions.Agents.Exercises.Microbes
Syntax
public class Microbe : KaijuController
Properties
All
All microbes currently in the world.
Declaration
public static IReadOnlyCollection<Microbe> All { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<Microbe> |
Cooldown
The time in seconds the microbe needs to wait before it can KaijuSolutions.Agents.Exercises.Microbes.Microbe.Mate(KaijuSolutions.Agents.Exercises.Microbes.Microbe) again.
Declaration
public float Cooldown { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Decay
How much Energy this microbe loses per second.
Declaration
public float Decay { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Energy
The current energy of this microbe. This will Decay every second, and this microbe needs energy to stay alive. Walk into EnergyPickup pickups to restore this. Microbes with higher energy levels than other microbes can eat them.
Declaration
public float Energy { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
OnCooldown
If this microbe is currently on a cooldown for mating.
Declaration
public bool OnCooldown { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
Compatible(Microbe)
See if this microbe is compatible to mate with another microbe. Note this does not check if either microbe is still on Cooldown for mating. For that, check OnCooldown.
Declaration
public bool Compatible(Microbe other)
Parameters
| Type | Name | Description |
|---|---|---|
| Microbe | other | The other microbe. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If this microbe is compatible to mate with another microbe. |
Eatable(Microbe)
See if this microbe could eat another microbe. Note this does not check if this has enough Energy to eat the other microbe, being more Energy than the other microbe has.
Declaration
public bool Eatable(Microbe other)
Parameters
| Type | Name | Description |
|---|---|---|
| Microbe | other | The other microbe. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If this microbe could eat another microbe. |
Spawn(KaijuAgent, Single, Vector2, UInt32)
Spawn a microbe.
Declaration
public static void Spawn(KaijuAgent microbePrefab, float energy, Vector2 position, uint identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | microbePrefab | The prefab to spawn. |
| System.Single | energy | The energy level to spawn with. |
| Vector2 | position | The position to spawn the microbe at. |
| System.UInt32 | identifier | The microbe identifier type. |
Events
OnEat
Callback for this microbe eating.
Declaration
public event MicrobeAction OnEat
Event Type
| Type | Description |
|---|---|
| MicrobeAction |
OnEaten
Callback for this microbe being eaten.
Declaration
public event MicrobeAction OnEaten
Event Type
| Type | Description |
|---|---|
| MicrobeAction |
OnEatGlobal
Global callback for this microbe eating.
Declaration
public event MultiMicrobeAction OnEatGlobal
Event Type
| Type | Description |
|---|---|
| MultiMicrobeAction |
OnMate
Callback for this microbe mating.
Declaration
public event MicrobeAction OnMate
Event Type
| Type | Description |
|---|---|
| MicrobeAction |
OnMateGlobal
Global callback for this microbe mating.
Declaration
public event MultiMicrobeAction OnMateGlobal
Event Type
| Type | Description |
|---|---|
| MultiMicrobeAction |