PseudoCode Managers - Milowan/WarChildPort GitHub Wiki

AIManager -> AActor

Array of Enemies: AIPool

Int: Poolsize

GameObject: BasicRiflemanPrefab

GameObject: AdvancedRiflemanPrefab

GameObject: MachinePistolerPrefab

Array of Transforms: spawnPoints

Character: initialTarget

void Awake

Set the pool size to 30.

Loop through the pool,

make 1/3 of the pool riflemen.

make 1/3 of the pool advanced riflemen.

make the last third of the pool machine pistol men.

Set spawnPoints size to the number of children of this manager.

Loop through the pool,

set spawnPoint[i] to child[i] position.

void StartWithTarget(Character)

Set initialTarget to function parameter.

Transform[] GetSpawnPoints

Return spawnPoints.

Enemy GetInactiveEnemy

Create temp variable type Enemy.

For each Enemy in AIPool,

if this enemy is active,

  set the temp variable to this enemy

  set the temp variable's target to initialTarget

  break the loop.

Return the temp variable.

int GetPoolSize

Return AIPool length/size/count.

BulletManager -> AActor

void Start

void Update

GameEventManager -> AActor

-UE version of Delegates- void GameEvent

static GameEvent: GameStart

static GameEvent: GameOver

static GameEvent: Pause

static GameEvent: UnPause

void TriggerGameStart

If GameStart is not null,

Trigger GameStart event

void TriggerGameOver

If GameOver is not null,

Trigger the GameOver event

void TriggerPause

If Pause is not null,

Trigger the Pause event

void TriggerUnPause

If UnPause is not null,

Trigger the UnPause event

UIManager -> AActor

-UE version of Delegates- void UIEvent

static UIEvent OpenNavigation

static UIEvent CloseNavigation

static UIEvent OpenArsenal

static UIEvent CloseArsenal

static UIEvent OpenExtraction

static UIEvent CloseExtraction

void OpenNav

If OpenNavigation is not null,

Trigger the OpenNavigation event

void CloseNav

If CloseNavigation is not null,

Trigger the CloseNavigation event

void OpenArsenal

If OpenArsenal is not null,

Trigger the OpenArsenal event

void CloseArsenal

If CloseArsenal is not null,

Trigger the CloseArsenal event

void OpenExtract

If OpenExtraction is not null,

Trigger the OpenExtraction event

void CloseExtract

If CloseExtraction is not null,

Trigger the CloseExtraction event

PlayerController -> AActor

float movSpeed

float sensitivity

float pitch

float maxPitch

float* yaw

float jumpSpeed

bool jumping

Camera playerCamera

Player player

void Start

Set jumping to false.

Set jumpSpeed to 10.

Set maxPitch to 30.

Set sensitivity to 5

Set pitch to 0.

Set yaw to 0.

Set player to the player object.

Set movSpeed to the player object's speed variable.

set playerCamera to the main camera object.

void FixedUpdate

Local Vector3 set:

x to Horizontal input axis multiplied by movSpeed,

y to zero,

z to Vertical input axis multiplied by movSpeed.

Set yaw += MouseX input axis multiplied by sensitivity.

Set pitch -= MouseY input axis multiplied by half of sensitivity.

If pitch is greater than maxPitch,

Set pitch to maxPitch.

If pitch is less than negative maxPitch,

Set pitch to negative maxPitch.

Set this object's transform-rotation to (0, yaw, 0). turns player left and right

Execute player object's UpdateWeapon with parameters: pitch, yaw.

Set the playerCamera object's transform-rotation to (pitch, yaw, 0). allows the camera to also look up and down

If the player presses LMB ("Fire1"),

Execute the player object's PullTrigger function.

void OnCollisionEnter(Collision)

If function parameter is terrain,

Set jumping to false

MissionManager -> AActor

GameObject playerPrefab

void Awake

Set cursor lock state to locked.

Instantiate the player prefab at the PlayerSpawn transform position.

virtual void Extract

DefenseManager -> MissionManager

float waveCooldown

float cooldownTimer

float spawnCooldown

float spawnCooldownTimer

int wave

int addPerWave

int maxSpawn

int spawnCount

static bool waveOver

bool canSpawn

GameObject extractionPrefab

Character defensePoint

AIManager aiManager

void Start

Set waveCooldown to 5.

Set cooldownTimer to 0.

Set spawnCooldown to 3.

Set spawmCooldownTimer to spawnCooldown.

Set wave to 0.

Set maxSpawn to 5.

Set canSpawn to false.

Set addPerWave to 5.

Execute the StartWave function.

void FixedUpdate

Set the playerPrefab's PlayerHud's Objective' text to "Defend the Objective: wave".

If canSpawn is false,

If waveOver is true,

  If cooldownTimer is greater or equal to waveCooldown,

     Execute StartWave function.

  Else,

     cooldownTimer += Delta Time.

  If wave divided by 5 has no remainder,

     Execute Extract function.

Else,

If cooldownTimer is greater or equal to spawnCooldown,

  Set local **Enemy** to aiManager's GetInactiveEnemy.

  If local **Enemy** variable is not null,

     Set local **Array of Transforms** to aiManager's GetSpawnPoints.

     Execute local **Enemy** Initialize with parameters:

        spawnPoints[Random number in range of 0-spawnPoints size].

     Execute local **Enemy** Spawn.

     If spawnCount equals maxSpawn minus 1,

        Execute local **Enemy** IsLast.

  Set cooldownTimer to 0.

  Increment spawnCount.

  If spawnCount is greater or equal to maxSpawn,

     Set canSpawn to false.

cooldownTimer += Delta Time.

void StartWave

Increment wave.

maxSpawn += addPerWave.

Set canSpawn to true.

Set cooldownTimer to 0.

override void Extract

Execute GameEventManager's TriggerPause.

Execute UIManager's OpenExtract.

ExterminationManager -> MissionManager

int killGoal

int killCount

int liveEnemies

int maxLiving

AIManager aiManager

void Start

Set liveEnemies to 0.

Set maxLiving to aiManager's GetPoolSize.

Set killGoal to 20.

set killCount to 0.

void FixedUpdate

Set the playerPrefab's PlayerHud's Objective' text to "Slaughter the enemy! killCount/killGoal".

If killCount is greater or equal to killGoal,

Execute the Extract function.

Else if liveEnemies is less than maxLiving

Set local Enemy to aiManager's GetInactiveEnemy.

If local Enemy variable is not null,

  Set local **Array of Transforms** to aiManager's GetSpawnPoints.

  Execute local **Enemy** Initialize with parameters:

     spawnPoints[Random number in range of 0-spawnPoints size].

  Execute local **Enemy** Spawn.

override void Extract

Unreal version of loading the Unreal version of the "scene": MissionComplete.

MissionTracker

static Mission currentMission

static void SetCurrentMission(Mission)

Set currentMission to the function parameter value.