C# Class RTSObjectFactory, ES2015C

Utility class used to easily get prefab references for the various objects available in the game.
Mostrar archivo Open project: jgirald/ES2015C

Public Methods

Method Description
GetObjectCost ( RTSObjectType type, PlayerCivilization civilization ) : int

Get the cost of creating the specified object for the specified civilization.

GetObjectIconSprite ( RTSObjectType type, PlayerCivilization civilization ) : Sprite

Get the preview icon sprite the specified object for the specified civilization.

GetObjectTemplate ( RTSObjectType type, PlayerCivilization civilization, bool useFallback = false ) : GameObject

Get the default object resource prefab for the specified civilization.

PrintAvailableObjectTable ( StreamWriter sw ) : void

Prints a table to the log showing which objects are available for each civilization.

Private Methods

Method Description
GetObjectInfo ( RTSObjectType type, PlayerCivilization civilization ) : ObjectInfo,

Memoize, if required, the information for the specified object and civilization which is initialized on the start script.

LoadAndCheckPrefab ( string prefabPath, bool warnNotExisting ) : GameObject

Loads a prefab (as in Resources.Load) and checks that the prefab is correctly configured.

Method Details

GetObjectCost() public static method

Get the cost of creating the specified object for the specified civilization.
public static GetObjectCost ( RTSObjectType type, PlayerCivilization civilization ) : int
type RTSObjectType The type of the object to create.
civilization PlayerCivilization The civilization of the object to create.
return int

GetObjectIconSprite() public static method

Get the preview icon sprite the specified object for the specified civilization.
public static GetObjectIconSprite ( RTSObjectType type, PlayerCivilization civilization ) : Sprite
type RTSObjectType The type of the object.
civilization PlayerCivilization The civilization of the object.
return Sprite

GetObjectTemplate() public static method

Get the default object resource prefab for the specified civilization.
public static GetObjectTemplate ( RTSObjectType type, PlayerCivilization civilization, bool useFallback = false ) : GameObject
type RTSObjectType The type of object to load.
civilization PlayerCivilization The civilization of the player.
useFallback bool If resource is not available for given civilization, return an equivalent for another civilization.
return GameObject

PrintAvailableObjectTable() public static method

Prints a table to the log showing which objects are available for each civilization.
public static PrintAvailableObjectTable ( StreamWriter sw ) : void
sw StreamWriter
return void