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
ClassID
string- The class identifier used for the PrefabIdentifier component whenever applicable.
PrefabFileName
string- Name of the prefab file.
TechType
TechType- 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
fileName
string- 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(Atlas.Sprite sprite)
Parameters
sprite
Atlas.Sprite
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
sprite
Sprite
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
size
Vector2int- 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
classId
string- The class identifier used for the PrefabIdentifier component whenever applicable.
unlockAtStart
bool- Whether this tech type should be unlocked on game start or not. Default to true.
techTypeOwner
Assembly- 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
classId
string- The class identifier used for the PrefabIdentifier component whenever applicable.
displayName
string- The display name of this Tech Type, can be anything. If null or empty, this will use the language line "{enumName}" instead.
description
string- The tooltip displayed when hovered in the PDA, can be anything. If null or empty, this will use the language line "Tooltip_{enumName}" instead.
language
string- The language for this entry. Defaults to English.
unlockAtStart
bool- Whether this tech type should be unlocked on game start or not. Defaults to false.
techTypeOwner
Assembly- 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.