Legacy:Fyfe/PawnFactory

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 07:06, 19 November 2007 by Sweavo (talk | contribs)
UT2004 :: Actor >> PawnFactory (Custom)

A generic factory for spawning pawns. The pawns need to be a sub-class of AnotherPawn.

NOTE: If your looking for a factory for vehicles check out Engine.SVehicleFactory

Properties

Main

bool bEnabled
Factory is enabled by default.
class<AnotherPawn> PawnClass
The pawn to spawn.
int MaxPawnCount
The max number of pawns this factory can create.

Hidden

int PawnCount
The current number of pawns this factory has created.

Events

PawnCreated( AnotherPawn Pawn )
Called by the factory when a pawn is created.
PawnDestroyed( AnotherPawn Pawn )
Called by the pawn when it's destroyed.
Trigger( Actor Other, Pawn EventInstigator )
Spawns a new pawn if PawnClass is set and we haven't reached the MaxPawnCount.

Code

Related Topics

Discussion

fyfe: Nothing overly fancy or original, it's based off of Engine.SVehicleFactory.

fyfe: Added PawnCreated(), and added some code to set bEnabled to false while PawnCount == MaxPawnCount or if PawnClass isn't set.