Struct PrefabInfo
Data class that represents information about a prefab.
public record struct PrefabInfo : IEquatable<PrefabInfo>
- Implements
- Inherited Members
Constructors
PrefabInfo(string, string, TechType)
Data class that represents information about a prefab.
public PrefabInfo(string ClassID, string PrefabFileName, TechType TechType)
Parameters
ClassIDstring- The class identifier used for the PrefabIdentifier component whenever applicable.
PrefabFileNamestring- Name of the prefab file.
TechTypeTechType- The TechType of the corresponding item.
Properties
ClassID
The class identifier used for the PrefabIdentifier component whenever applicable.
public string ClassID { readonly get; set; }
Property Value
PrefabFileName
Name of the prefab file.
public string PrefabFileName { readonly get; set; }
Property Value
TechType
The TechType of the corresponding item.
public TechType TechType { readonly get; set; }
Property Value
- TechType
Methods
WithFileName(string)
Sets the prefab file name as prefab info.
public PrefabInfo WithFileName(string fileName)
Parameters
fileNamestring- The prefab file name.
Returns
- PrefabInfo
- A reference to this instance after the operation has completed.
WithIcon(Sprite)
Adds an icon for TechType.
public PrefabInfo WithIcon(Sprite sprite)
Parameters
spriteSprite
Returns
- PrefabInfo
- A reference to this instance after the operation has completed.
WithSizeInInventory(Vector2int)
Sets the size of this tech type in the inventory.
public PrefabInfo WithSizeInInventory(Vector2int size)
Parameters
sizeVector2int- The 2x2 vector size
Returns
- PrefabInfo
- A reference to this instance after the operation has completed.
WithTechType(string, bool, Assembly)
public static PrefabInfo WithTechType(string classId, bool unlockAtStart = false, Assembly techTypeOwner = null)
Parameters
classIdstring- The class identifier used for the PrefabIdentifier component whenever applicable.
unlockAtStartbool- Whether this tech type should be unlocked on game start or not. Default to true.
techTypeOwnerAssembly- The assembly that owns the created tech type. The name of this assembly will be shown in the PDA.
Returns
- PrefabInfo
- An instance of the constructed PrefabInfo.
Remarks
This overload does not do anything about the language side of this prefab (DisplayName and Description) and assumes that the entries were already added.
For the DisplayName, the language line must be "{ClassID}".
For the Description, the language line must be "Tooltip_{ClassID}" instead.
For the DisplayName, the language line must be "{ClassID}".
For the Description, the language line must be "Tooltip_{ClassID}" instead.
- See Also
WithTechType(string, string, string, string, bool, Assembly)
public static PrefabInfo WithTechType(string classId, string displayName, string description, string language = "English", bool unlockAtStart = false, Assembly techTypeOwner = null)
Parameters
classIdstring- The class identifier used for the PrefabIdentifier component whenever applicable.
displayNamestring- The display name of this Tech Type, can be anything. If null or empty, this will use the language line "{enumName}" instead.
descriptionstring- The tooltip displayed when hovered in the PDA, can be anything. If null or empty, this will use the language line "Tooltip_{enumName}" instead.
languagestring- The language for this entry. Defaults to English.
unlockAtStartbool- Whether this tech type should be unlocked on game start or not. Defaults to false.
techTypeOwnerAssembly- The assembly that owns the created tech type. The name of this assembly will be shown in the PDA.
Returns
- PrefabInfo
- An instance of the constructed PrefabInfo.