Overview
All runtime types live in the SimpleEnemyForge namespace. Each forge wizard generates
a database ScriptableObject that implements a corresponding interface. You can access data either
by casting directly to the generated type, or by using the interface for generic code.
Convention: {Prefix} refers to the Class Prefix you set in each
wizard's Step 1 (Setup). The Enemy Forge uses the prefix alone (e.g., MyEnemyDatabase).
Other forges append a suffix: {Prefix}SquadDatabase, {Prefix}SpawnDatabase,
{Prefix}ScalingDatabase, {Prefix}WaveDatabase,
{Prefix}BehaviorDatabase, {Prefix}FactionDatabase.
Two access patterns are available for all databases:
// Pattern 1: Direct cast (type-safe, requires knowing generated class name)
var db = enemyDatabaseAsset as MyEnemyDatabase;
var goblin = db.GetEnemyByCode("GOBLIN_WARRIOR");
// Pattern 2: Interface cast (generic, works with any enemy database)
var source = enemyDatabaseAsset as ISimpleEnemyDataSource;
var goblin = source.GetEnemyByCode("GOBLIN_WARRIOR");
Enemy Database
SimpleEnemyDefinition Struct
Defines a single enemy with all its properties. Uses dynamic property arrays that correspond
to the property definitions stored in the database.
| Field | Type | Description |
name | string | Display name shown to players (e.g., "Goblin Warrior") |
code | string | Unique UPPER_SNAKE_CASE identifier (e.g., "GOBLIN_WARRIOR") |
description | string | Enemy description/lore text |
icon | Sprite | Enemy portrait/sprite icon |
categoryValues | int[] | Category selections (index into each category's entries). For multi-select categories, this holds -1 as a placeholder. |
categoryMultiValues | SimpleIntArray[] | Multi-select category values. For single-select categories, the inner array is empty. |
flagValues | bool[] | Boolean flag values aligned with database flag definitions |
numericValues | float[] | Numeric property values. For range properties, this is the min value. |
numericRangeMaxValues | float[] | Max values for range numeric properties. For non-range properties, ignored (0). |
textValues | string[] | Text property values aligned with database text definitions |
modifiers | ScriptableObject[] | SAF modifier references (empty if SAF not installed) |
lootTableCode | string | SIF loot table code (empty if SIF not installed) |
lootTable | ScriptableObject | SIF loot table reference (null if SIF not installed) |
Convenience Accessors
SimpleEnemyDefinition provides safe accessor methods that return defaults for out-of-range indices:
| Method | Returns | Description |
GetCategoryValue(int categoryIndex) | int | Selected entry index for a single-select category (default: 0) |
GetCategoryMultiValues(int categoryIndex) | int[] | Selected entry indices for a multi-select category |
GetFlagValue(int flagIndex) | bool | Flag value (default: false) |
GetNumericValue(int numericIndex) | float | Numeric value (default: 0f) |
GetNumericRange(int numericIndex) | (float min, float max) | Range numeric min/max values |
GetTextValue(int textIndex) | string | Text value (default: "") |
ISimpleEnemyDataSource Interface
Enemy Access
| Method / Property | Returns | Description |
EnemyCount | int | Total number of enemies in database |
GetEnemyDefinitions() | SimpleEnemyDefinition[] | Get all enemy definitions |
GetEnemyNames() | string[] | Get all enemy display names |
GetEnemyCodes() | string[] | Get all enemy codes |
GetEnemyByName(string name) | SimpleEnemyDefinition? | Get enemy by display name, or null |
GetEnemyByCode(string code) | SimpleEnemyDefinition? | Get enemy by code, or null |
HasEnemy(string nameOrCode) | bool | Check if enemy exists by name or code |
GetEnemyEnumType() | Type | Get the generated enum type for type-safe access |
Property Definitions
| Method | Returns | Description |
GetCategoryLabels() | string[] | Category labels (e.g., "Enemy Type", "Rank") |
GetCategoryEntries(int categoryIndex) | string[] | Entries for a specific category |
GetFlagNames() | string[] | Flag names (e.g., "Is Boss", "Is Flying") |
GetNumericNames() | string[] | Numeric property names (e.g., "HP", "Attack Power") |
GetTextNames() | string[] | Text property names (e.g., "Lore", "Weakness Hints") |
Dynamic Filtering
| Method | Returns | Description |
GetEnemiesByCategory(int categoryIndex, int entryIndex) | SimpleEnemyDefinition[] | All enemies with specified category value |
GetEnemiesByFlag(int flagIndex, bool value) | SimpleEnemyDefinition[] | All enemies with specified flag value |
GetEnemiesByNumericRange(int numericIndex, float min, float max) | SimpleEnemyDefinition[] | All enemies with numeric in range |
Code Example
using SimpleEnemyForge;
// Get database via interface
var db = myDatabaseAsset as ISimpleEnemyDataSource;
// Look up an enemy
var enemy = db.GetEnemyByCode("SHADOW_WRAITH");
if (enemy.HasValue)
{
Debug.Log($"Name: {enemy.Value.name}");
Debug.Log($"HP: {enemy.Value.GetNumericValue(0)}");
Debug.Log($"Is Boss: {enemy.Value.GetFlagValue(0)}");
}
// Filter enemies by category
var bosses = db.GetEnemiesByFlag(0, true); // flag 0 = "Is Boss"
var undead = db.GetEnemiesByCategory(0, 2); // category 0 entry 2 = "Undead"
Squad Database
SimpleSquadSlot Struct
| Field | Type | Description |
enemyCode | string | Enemy code referencing the enemy database |
countMin | int | Minimum spawn count for this slot |
countMax | int | Maximum spawn count (same as min for fixed count) |
level | int | Level override (-1 = use enemy default) |
SimpleSquadGroup Struct
| Field | Type | Description |
code | string | Unique code identifier (e.g., "GOBLIN_PATROL") |
name | string | Display name (e.g., "Goblin Patrol") |
description | string | Description of this squad |
slots | SimpleSquadSlot[] | Enemy slots in this squad |
categoryValues | int[] | Category values (aligned with database definitions) |
flagValues | bool[] | Flag values (aligned with database definitions) |
numericValues | float[] | Numeric values (aligned with database definitions) |
textValues | string[] | Text values (aligned with database definitions) |
ISimpleSquadDataSource Interface
| Method / Property | Returns | Description |
SquadCount | int | Total number of squads in database |
GetAllSquads() | SimpleSquadGroup[] | Get all squad groups |
GetSquadByCode(string code) | SimpleSquadGroup? | Get squad by code, or null |
GetSquadsContainingEnemy(string enemyCode) | SimpleSquadGroup[] | All squads containing a specific enemy |
GetCategoryLabels() | string[] | Category labels |
GetCategoryEntries(int categoryIndex) | string[] | Entries for a category |
GetFlagNames() | string[] | Flag names |
GetNumericNames() | string[] | Numeric property names |
GetTextNames() | string[] | Text property names |
Code Example
var squadDb = mySquadAsset as ISimpleSquadDataSource;
var patrol = squadDb.GetSquadByCode("GOBLIN_PATROL");
if (patrol.HasValue)
{
foreach (var slot in patrol.Value.slots)
{
int count = Random.Range(slot.countMin, slot.countMax + 1);
Debug.Log($"Spawn {count}x {slot.enemyCode}");
}
}
Spawn Database
Data Hierarchy
Spawn tables use a 4-level hierarchy: Table › Pool › Entry › Condition.
SimpleSpawnTable Struct
| Field | Type | Description |
code | string | Unique code identifier (e.g., "FOREST_SPAWNS") |
name | string | Display name |
description | string | Description of this spawn table |
pools | SimpleSpawnPool[] | Pools in this spawn table |
SimpleSpawnPool Struct
| Field | Type | Description |
name | string | Display name (e.g., "Main Wave", "Reinforcements") |
rollCountMin | int | Minimum number of rolls from this pool |
rollCountMax | int | Maximum number of rolls from this pool |
rollChance | float | Chance (0-100) that this pool activates |
conditions | SimpleSpawnCondition[] | Conditions that must be met for this pool to activate |
entries | SimpleSpawnEntry[] | Entries in this pool |
SimpleSpawnEntry Struct
| Field | Type | Description |
squadCode | string | Squad code (empty if single enemy) |
singleEnemyCode | string | Enemy code (empty if squad) |
weight | float | Base weight for selection (higher = more likely) |
conditions | SimpleSpawnCondition[] | Conditions for this entry to be included |
weightModifiers | SimpleSpawnWeightModifier[] | Modifiers that adjust weight based on context |
IsSquad | bool | True if this entry references a squad group |
SimpleSpawnCondition Struct
| Field | Type | Description |
logic | SimpleSpawnConditionLogic | Logic operator for chaining (None for first condition) |
sourceType | SimpleSpawnConditionSourceType | What type of definition to check (Category, Flag, Numeric) |
sourceIndex | int | Index into the relevant definition array |
comparison | SimpleSpawnConditionComparison | How to compare the value |
value | float | Value to compare against |
Condition Enums
| Enum | Values |
SimpleSpawnConditionSourceType | Category, Flag, Numeric |
SimpleSpawnConditionComparison | Equals, NotEquals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual |
SimpleSpawnConditionLogic | None, And, Or, Not |
SimpleSpawnWeightModifier Struct
| Field | Type | Description |
numericIndex | int | Which numeric definition affects weight |
modifierType | SimpleSpawnWeightModifierType | FlatPerPoint or PercentPerPoint |
value | float | Value per point (flat or percent) |
ISimpleSpawnDataSource Interface
| Method / Property | Returns | Description |
SpawnTableCount | int | Total number of spawn tables |
GetSpawnTables() | SimpleSpawnTable[] | Get all spawn tables |
GetSpawnTable(string code) | SimpleSpawnTable? | Get spawn table by code, or null |
GetSpawnTableCodes() | string[] | Get all spawn table codes |
GetContextCategoryLabels() | string[] | Context category labels (e.g., "Biome", "Time of Day") |
GetContextCategoryEntries(int categoryIndex) | string[] | Entries for a context category |
GetContextFlagNames() | string[] | Context flag names (e.g., "Is Night", "Is Raining") |
GetContextNumericNames() | string[] | Context numeric names (e.g., "Player Level", "Difficulty") |
GetTablesContainingEnemy(string enemyCode) | SimpleSpawnTable[] | All tables that can spawn a specific enemy |
GetTablesContainingSquad(string squadCode) | SimpleSpawnTable[] | All tables that reference a specific squad |
Scaling Database
SimpleScalingType Enum
| Value | Formula |
None | No scaling — use base value as-is |
Linear | base + (level - 1) * increment |
Percentage | base * (1 + (level - 1) * percentage / 100) |
Exponential | base * pow(exponentialBase, level - 1) |
Curve | base + curve.Evaluate(level / maxLevel) * curveMultiplier |
Step | Direct lookup table — at level X, value is Y |
SimpleScalingStep Struct
| Field | Type | Description |
level | int | Level at which this value takes effect |
value | float | The value to use at this level (absolute, not additive) |
SimpleScalingRule Struct
| Field | Type | Description |
numericIndex | int | Index into the enemy database's numeric definitions |
scalingType | SimpleScalingType | How this rule scales the value |
increment | float | Value added per level (Linear) |
percentage | float | Percent increase per level (Percentage) |
exponentialBase | float | Base of exponentiation (Exponential) |
curve | AnimationCurve | Curve mapping normalized level to a multiplier (Curve) |
curveMultiplier | float | Scales the curve output (Curve) |
curveMaxLevel | int | Maximum level for curve normalization (Curve) |
steps | SimpleScalingStep[] | Level-value lookup table (Step) |
SimpleScalingProfile Struct
| Field | Type | Description |
code | string | Unique code for this profile (often matches an enemy code) |
name | string | Display name |
description | string | Optional description |
rules | SimpleScalingRule[] | Scaling rules for individual numeric properties |
ISimpleScalingDataSource Interface
| Method / Property | Returns | Description |
ProfileCount | int | Total number of scaling profiles |
GetScalingProfiles() | SimpleScalingProfile[] | Get all scaling profiles |
GetScalingProfile(string code) | SimpleScalingProfile? | Get profile by code, or null |
GetProfileCodes() | string[] | Get all profile codes |
GetNumericNames() | string[] | Numeric property names (copied from linked enemy DB) |
GetScaledValue(string profileCode, int numericIndex, float baseValue, int level) | float | Compute scaled value for a specific profile, property, and level |
Wave Database
Data Hierarchy
Wave data uses a 3-level hierarchy: Sequence › Wave › Entry.
SimpleWaveEntry Struct
| Field | Type | Description |
enemyCode | string | Single enemy code (empty if using squad) |
squadCode | string | Squad code (empty if using single enemy) |
count | int | How many to spawn from this entry |
spawnDelay | float | Delay in seconds between each individual spawn |
startTime | float | Time offset from the start of the wave |
IsSquad | bool | True if this entry references a squad group |
SimpleWave Struct
| Field | Type | Description |
name | string | Display name (e.g., "Wave 1", "Boss Wave") |
preDelay | float | Delay before this wave starts spawning |
postDelay | float | Delay after this wave finishes before the next begins |
entries | SimpleWaveEntry[] | Entries to spawn during this wave |
SimpleWaveSequence Struct
| Field | Type | Description |
code | string | Unique code identifier (e.g., "FOREST_WAVES") |
name | string | Display name |
description | string | Description of this wave sequence |
waves | SimpleWave[] | Ordered waves in this sequence |
loopAfterLast | bool | Whether to loop after the last wave |
difficultyScalePerLoop | float | Difficulty multiplier per loop (e.g., 1.2 = 20% harder) |
maxLoops | int | Maximum loop iterations (0 = infinite) |
categoryValues | int[] | Category values (aligned with database definitions) |
flagValues | bool[] | Flag values |
numericValues | float[] | Numeric values |
textValues | string[] | Text values |
ISimpleWaveDataSource Interface
| Method / Property | Returns | Description |
WaveSequenceCount | int | Total number of wave sequences |
GetWaveSequences() | SimpleWaveSequence[] | Get all wave sequences |
GetWaveSequence(string code) | SimpleWaveSequence? | Get sequence by code, or null |
GetWaveSequenceCodes() | string[] | Get all sequence codes |
GetCategoryLabels() | string[] | Category labels for wave sequences |
GetCategoryEntries(int categoryIndex) | string[] | Entries for a category |
GetFlagNames() | string[] | Flag names |
GetNumericNames() | string[] | Numeric property names |
GetTextNames() | string[] | Text property names |
GetSequencesContainingEnemy(string enemyCode) | SimpleWaveSequence[] | All sequences containing a specific enemy |
GetSequencesContainingSquad(string squadCode) | SimpleWaveSequence[] | All sequences containing a specific squad |
Behavior Database
SimpleBehaviorRule Struct
| Field | Type | Description |
conditions | SimpleSpawnCondition[] | Conditions that must be satisfied to trigger this rule (reuses spawn condition system) |
actionCode | string | User-defined action code (e.g., "HEAL", "FLEE", "AOE_ATTACK") |
priority | int | Priority for conflict resolution — higher wins |
cooldown | float | Minimum seconds between triggers of this rule |
SimpleBehaviorProfile Struct
| Field | Type | Description |
code | string | Unique code for this profile (e.g., "AGGRESSIVE_MELEE") |
name | string | Display name |
description | string | Description of this profile's behavior pattern |
rules | SimpleBehaviorRule[] | Behavior rules evaluated in priority order |
categoryValues | int[] | Category values (aligned with database definitions) |
flagValues | bool[] | Flag values |
numericValues | float[] | Numeric values |
textValues | string[] | Text values |
ISimpleBehaviorDataSource Interface
| Method / Property | Returns | Description |
ProfileCount | int | Total number of behavior profiles |
GetBehaviorProfiles() | SimpleBehaviorProfile[] | Get all behavior profiles |
GetBehaviorProfile(string code) | SimpleBehaviorProfile? | Get profile by code, or null |
GetProfileCodes() | string[] | Get all profile codes |
GetProfileNames() | string[] | Get all profile display names |
Faction Database
SimpleFactionStance Enum
| Value | Int | Description |
Hostile | -2 | Factions are openly hostile — attack on sight |
Unfriendly | -1 | Factions are unfriendly — may attack under certain conditions |
Neutral | 0 | Factions are neutral — no inherent behavior |
Friendly | 1 | Factions are friendly — will not attack, may cooperate |
Allied | 2 | Factions are allied — fully cooperative |
SimpleFactionDefinition Struct
| Field | Type | Description |
code | string | Unique code identifier (e.g., "UNDEAD") |
name | string | Display name (e.g., "The Undead") |
description | string | Optional description of the faction |
color | Color | Optional color for editor display |
categoryValues | int[] | Category values |
flagValues | bool[] | Flag values |
numericValues | float[] | Numeric values |
textValues | string[] | Text values |
ISimpleFactionDataSource Interface
Faction Access
| Method / Property | Returns | Description |
FactionCount | int | Total number of factions |
GetFactionNames() | string[] | Get all faction names |
GetFactionCodes() | string[] | Get all faction codes |
GetFactionDefinitions() | SimpleFactionDefinition[] | Get all faction definitions |
Relationship Queries
| Method | Returns | Description |
GetRelationship(string codeA, string codeB) | SimpleFactionStance | Get stance between two factions by code |
GetRelationship(int indexA, int indexB) | SimpleFactionStance | Get stance between two factions by index |
IsHostile(string codeA, string codeB) | bool | Check if stance is Hostile |
IsAllied(string codeA, string codeB) | bool | Check if stance is Allied |
IsFriendly(string codeA, string codeB) | bool | Check if stance is Friendly or higher |
GetHostileFactions(string factionCode) | string[] | All factions hostile to the specified faction |
GetAlliedFactions(string factionCode) | string[] | All factions allied with the specified faction |
Metadata Access
| Method | Returns | Description |
GetCategoryLabels() | string[] | Category labels |
GetCategoryEntries(int categoryIndex) | string[] | Entries for a category |
GetFlagNames() | string[] | Flag names |
GetNumericNames() | string[] | Numeric property names |
GetTextNames() | string[] | Text property names |
Runtime Helpers
SEF includes 7 static/instance helper classes for common runtime operations. These are
ready to use out of the box — no code generation needed.
1. SimpleSpawnRoller
Rolls spawn tables using weighted random selection. Evaluates pool conditions, computes
effective weights with modifiers, and performs with-replacement random selection.
| Method | Returns | Description |
Roll(SimpleSpawnTable table, SimpleSpawnContext context) | SpawnRollResult[] | Roll using Unity's Random |
Roll(SimpleSpawnTable table, SimpleSpawnContext context, System.Random rng) | SpawnRollResult[] | Roll with a specific RNG (for deterministic results) |
RollPool(SimpleSpawnPool pool, int poolIndex, SimpleSpawnContext context, System.Random rng) | SpawnRollResult[] | Roll a single pool |
SpawnRollResult struct fields: enemyCode, squadCode,
IsSquad, sourcePoolName, poolIndex, entryIndex.
var context = SimpleSpawnContext.Create(1, 1, 2)
.SetCategory(0, 1) // Biome = Forest
.SetFlag(0, true) // Is Night = true
.SetNumeric(0, 15f) // Player Level = 15
.SetNumeric(1, 3f) // Difficulty = 3
.Build();
var results = SimpleSpawnRoller.Roll(spawnTable, context);
foreach (var r in results)
{
if (r.IsSquad)
Debug.Log($"Spawn squad: {r.squadCode} from pool '{r.sourcePoolName}'");
else
Debug.Log($"Spawn enemy: {r.enemyCode} from pool '{r.sourcePoolName}'");
}
2. SimpleSpawnContext
Holds current game state values for evaluating spawn and behavior conditions. Includes a
fluent builder pattern for easy construction.
| Method | Returns | Description |
SimpleSpawnContext.Create(int cats, int flags, int nums) | SimpleSpawnContextBuilder | Start building with fluent API |
builder.SetCategory(int index, int value) | SimpleSpawnContextBuilder | Set a category value |
builder.SetFlag(int index, bool value) | SimpleSpawnContextBuilder | Set a flag value |
builder.SetNumeric(int index, float value) | SimpleSpawnContextBuilder | Set a numeric value |
builder.Build() | SimpleSpawnContext | Build the final context |
3. SimpleSpawnEvaluator
Static building blocks for spawn condition evaluation and weight computation. Used internally
by SimpleSpawnRoller and available for custom spawn logic.
| Method | Returns | Description |
EvaluateSingleCondition(condition, context) | bool | Evaluate a single condition |
EvaluateConditions(conditions[], context) | bool | Evaluate a chain of conditions with And/Or/Not logic |
ComputeEffectiveWeight(entry, context) | float | Compute weight after conditions and modifiers (0 = excluded) |
IsPoolActive(pool, context) | bool | Check if a pool's conditions are met |
GetEligibleEntries(pool, context) | (int entryIndex, float weight)[] | Get all entries with weight > 0 |
4. SimpleScalingHelper
Static utility for computing scaled values from scaling rules and profiles.
| Method | Returns | Description |
ComputeScaledValue(rule, baseValue, level) | float | Apply a single scaling rule to a base value |
ScaleAllNumerics(profile, baseValues[], level) | float[] | Scale an entire array of numeric values |
ScaleEnemy(enemy, profile, level) | float[] | Scale an enemy's numeric values by profile and level |
ScaleEnemy(enemy, profile, level, difficultyMultiplier) | float[] | Scale with additional difficulty multiplier |
// Scale an enemy to level 10
var enemy = enemyDb.GetEnemyByCode("GOBLIN_WARRIOR").Value;
var profile = scalingDb.GetScalingProfile("GOBLIN_WARRIOR").Value;
float[] scaled = SimpleScalingHelper.ScaleEnemy(enemy, profile, 10);
// With difficulty multiplier (e.g., wave loop scaling)
float[] hardMode = SimpleScalingHelper.ScaleEnemy(enemy, profile, 10, 1.5f);
5. SimpleWaveRunner
Pure C# event-driven wave runner. Not a MonoBehaviour — you call Update(deltaTime)
from your own game loop. Drives a state machine through PreDelay, Spawning, PostDelay phases
with loop support.
Events
| Event | Signature | Description |
OnWaveStarted | Action<int, string> | Fires when a wave begins spawning (waveIndex, waveName) |
OnSpawnRequested | Action<WaveSpawnRequest> | Fires once per individual spawn |
OnWaveCompleted | Action<int, string> | Fires when all entries in a wave are dispatched |
OnSequenceCompleted | Action | Fires when the entire sequence is done |
OnLoopStarted | Action<int, float> | Fires when the sequence loops (loopCount, difficultyScale) |
OnPaused | Action | Fires when the runner is paused |
OnResumed | Action | Fires when the runner is resumed |
Control Methods
| Method | Description |
Start(SimpleWaveSequence sequence) | Start running a wave sequence from the beginning |
Update(float deltaTime) | Drive the state machine forward (call each frame) |
Pause() | Pause the runner |
Resume() | Resume after pausing |
Stop() | Stop and reset to idle |
SkipToWave(int waveIndex) | Skip to a specific wave |
SkipCurrentWave() | Skip remaining spawns in current wave |
Read-Only State
| Property | Type | Description |
Phase | WaveRunnerPhase | Current phase (Idle, PreDelay, Spawning, PostDelay, Complete) |
CurrentWaveIndex | int | Index of the current wave |
LoopCount | int | Completed loop iterations (0 on first play-through) |
CurrentDifficultyScale | float | Cumulative difficulty scale (starts at 1.0) |
ElapsedTime | float | Total elapsed time since Start (paused time excluded) |
IsPaused | bool | True if paused |
IsRunning | bool | True if actively running |
IsComplete | bool | True if sequence has completed |
var runner = new SimpleWaveRunner();
runner.OnWaveStarted += (index, name) => Debug.Log($"Wave {index}: {name} started");
runner.OnSpawnRequested += (req) =>
{
if (req.IsSquad)
SpawnSquad(req.squadCode, req.difficultyScale);
else
SpawnEnemy(req.enemyCode, req.difficultyScale);
};
runner.OnSequenceCompleted += () => Debug.Log("All waves complete!");
var sequence = waveDb.GetWaveSequence("FOREST_WAVES").Value;
runner.Start(sequence);
// In your Update loop:
void Update()
{
runner.Update(Time.deltaTime);
}
6. SimpleBehaviorEvaluator
Static methods for evaluating behavior profile rules against a spawn context. Uses the same
condition system as spawn tables.
| Method | Returns | Description |
EvaluateProfile(profile, context) | SimpleBehaviorRule[] | All matching rules, sorted by priority descending |
EvaluateBestAction(profile, context) | SimpleBehaviorRule? | Highest-priority matching rule, or null |
GetMatchingActionCodes(profile, context) | string[] | Action codes for all matching rules |
var profile = behaviorDb.GetBehaviorProfile("AGGRESSIVE_MELEE").Value;
var context = SimpleSpawnContext.Create(0, 1, 2)
.SetFlag(0, true) // In Combat = true
.SetNumeric(0, 0.3f) // HP Percent = 30%
.SetNumeric(1, 5f) // Distance to Target = 5
.Build();
var best = SimpleBehaviorEvaluator.EvaluateBestAction(profile, context);
if (best.HasValue)
Debug.Log($"Best action: {best.Value.actionCode} (priority {best.Value.priority})");
// Or get all matching actions
string[] actions = SimpleBehaviorEvaluator.GetMatchingActionCodes(profile, context);
// e.g., ["HEAL", "FLEE", "MELEE_ATTACK"] sorted by priority
7. SimpleFactionHelper
Static convenience methods for faction relationship queries beyond what
ISimpleFactionDataSource provides directly.
| Method | Returns | Description |
IsHostileOrUnfriendly(db, codeA, codeB) | bool | True if stance is less than Neutral |
IsFriendlyOrAllied(db, codeA, codeB) | bool | True if stance is greater than Neutral |
GetStanceValue(db, codeA, codeB) | int | Numeric stance value (-2 to 2) |
GetNonHostileFactions(db, factionCode) | string[] | All faction codes that are NOT hostile |
GetFactionsWithStance(db, factionCode, stance) | string[] | All factions with the exact specified stance |
var factionDb = myFactionAsset as ISimpleFactionDataSource;
// Check relationships
bool hostile = factionDb.IsHostile("UNDEAD", "HUMANS");
bool allied = factionDb.IsAllied("ELVES", "HUMANS");
// Get all enemies of a faction
string[] enemies = factionDb.GetHostileFactions("HUMANS");
// Extended queries via helper
bool threat = SimpleFactionHelper.IsHostileOrUnfriendly(factionDb, "UNDEAD", "HUMANS");
string[] nonHostile = SimpleFactionHelper.GetNonHostileFactions(factionDb, "HUMANS");
int stanceVal = SimpleFactionHelper.GetStanceValue(factionDb, "ELVES", "DWARVES"); // -2 to 2
Namespace Reference
All runtime types in the SimpleEnemyForge namespace:
SimpleEnemyForge (namespace)
├─ SimpleEnemyDefinition.cs
│ ├─ SimpleIntArray (struct)
│ └─ SimpleEnemyDefinition (struct)
├─ ISimpleEnemyDataSource.cs
│ └─ ISimpleEnemyDataSource (interface)
├─ SimpleEnemyEnums.cs
│ ├─ SimpleSpawnConditionSourceType (enum)
│ ├─ SimpleSpawnConditionComparison (enum)
│ ├─ SimpleSpawnConditionLogic (enum)
│ └─ SimpleSpawnWeightModifierType (enum)
├─ SimpleSquadGroup.cs
│ ├─ SimpleSquadSlot (struct)
│ └─ SimpleSquadGroup (struct)
├─ ISimpleSquadDataSource.cs
│ └─ ISimpleSquadDataSource (interface)
├─ SimpleSpawnTable.cs
│ ├─ StringArray (class)
│ ├─ SimpleSpawnCondition (struct)
│ ├─ SimpleSpawnWeightModifier (struct)
│ ├─ SimpleSpawnEntry (struct)
│ ├─ SimpleSpawnPool (struct)
│ └─ SimpleSpawnTable (struct)
├─ ISimpleSpawnDataSource.cs
│ └─ ISimpleSpawnDataSource (interface)
├─ SimpleScalingProfile.cs
│ ├─ SimpleScalingType (enum)
│ ├─ SimpleScalingStep (struct)
│ ├─ SimpleScalingRule (struct)
│ └─ SimpleScalingProfile (struct)
├─ ISimpleScalingDataSource.cs
│ └─ ISimpleScalingDataSource (interface)
├─ SimpleWaveDefinition.cs
│ ├─ SimpleWaveEntry (struct)
│ ├─ SimpleWave (struct)
│ └─ SimpleWaveSequence (struct)
├─ ISimpleWaveDataSource.cs
│ └─ ISimpleWaveDataSource (interface)
├─ SimpleBehaviorProfile.cs
│ ├─ SimpleBehaviorRule (struct)
│ └─ SimpleBehaviorProfile (struct)
├─ ISimpleBehaviorDataSource.cs
│ └─ ISimpleBehaviorDataSource (interface)
├─ SimpleBehaviorEvaluator.cs
│ └─ SimpleBehaviorEvaluator (static class)
├─ SimpleFactionData.cs
│ ├─ SimpleFactionStance (enum)
│ └─ SimpleFactionDefinition (struct)
├─ ISimpleFactionDataSource.cs
│ └─ ISimpleFactionDataSource (interface)
├─ SimpleSpawnContext.cs
│ ├─ SimpleSpawnContext (struct)
│ └─ SimpleSpawnContextBuilder (struct)
├─ SimpleSpawnEvaluator.cs
│ └─ SimpleSpawnEvaluator (static class)
├─ SimpleSpawnRoller.cs
│ ├─ SpawnRollResult (struct)
│ └─ SimpleSpawnRoller (static class)
├─ SimpleScalingHelper.cs
│ └─ SimpleScalingHelper (static class)
├─ SimpleWaveRunner.cs
│ ├─ WaveSpawnRequest (struct)
│ ├─ WaveRunnerPhase (enum)
│ └─ SimpleWaveRunner (class)
├─ SimpleFactionHelper.cs
│ └─ SimpleFactionHelper (static class)
└─ Demo/BestiaryDemo.cs
└─ BestiaryDemo (MonoBehaviour)