Class CustomPiece
Main interface for adding custom pieces to the game.
All custom pieces have to be wrapped inside this class to add it to Jötunns PieceManager.
All custom pieces have to be wrapped inside this class to add it to Jötunns PieceManager.
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Jotunn.Entities
Assembly: Jotunn.dll
Syntax
public class CustomPiece : CustomEntity
Constructors
| Improve this Doc View SourceCustomPiece(AssetBundle, String, PieceConfig)
Custom piece from a prefab loaded from an with a PieceConfig attached.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
Declaration
[Obsolete("Use CustomPiece(AssetBundle, string, bool, PieceConfig) instead and define if references should be fixed")]
public CustomPiece(AssetBundle assetBundle, string assetName, PieceConfig pieceConfig)
Parameters
Type | Name | Description |
---|---|---|
AssetBundle | assetBundle | A preloaded |
System.String | assetName | Name of the prefab in the bundle. |
PieceConfig | pieceConfig | The PieceConfig for this custom piece. |
CustomPiece(AssetBundle, String, Boolean, PieceConfig)
Custom piece from a prefab loaded from an with a PieceConfig attached.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
Declaration
public CustomPiece(AssetBundle assetBundle, string assetName, bool fixReference, PieceConfig pieceConfig)
Parameters
Type | Name | Description |
---|---|---|
AssetBundle | assetBundle | A preloaded |
System.String | assetName | Name of the prefab in the bundle. |
System.Boolean | fixReference | If true references for Mock<T> objects get resolved at runtime by Jötunn. |
PieceConfig | pieceConfig | The PieceConfig for this custom piece. |
CustomPiece(AssetBundle, String, String, Boolean)
Custom piece from a prefab loaded from an .
Will be added to the provided by name.
Can fix references from Mock<T>s or not.
Will be added to the
Can fix references from Mock<T>s or not.
Declaration
public CustomPiece(AssetBundle assetBundle, string assetName, string pieceTable, bool fixReference)
Parameters
Type | Name | Description |
---|---|---|
AssetBundle | assetBundle | A preloaded |
System.String | assetName | Name of the prefab in the bundle. |
System.String | pieceTable |
Name of the |
System.Boolean | fixReference | If true references for Mock<T> objects get resolved at runtime by Jötunn. |
CustomPiece(GameObject, PieceConfig)
Custom piece from a prefab with a PieceConfig attached.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
Declaration
[Obsolete("Use CustomPiece(GameObject, bool, PieceConfig) instead and define if references should be fixed")]
public CustomPiece(GameObject piecePrefab, PieceConfig pieceConfig)
Parameters
Type | Name | Description |
---|---|---|
GameObject | piecePrefab | The prefab for this custom piece. |
PieceConfig | pieceConfig | The PieceConfig for this custom piece. |
CustomPiece(GameObject, Boolean, PieceConfig)
Custom piece from a prefab with a PieceConfig attached.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
Declaration
public CustomPiece(GameObject piecePrefab, bool fixReference, PieceConfig pieceConfig)
Parameters
Type | Name | Description |
---|---|---|
GameObject | piecePrefab | The prefab for this custom piece. |
System.Boolean | fixReference | If true references for Mock<T> objects get resolved at runtime by Jötunn. |
PieceConfig | pieceConfig | The PieceConfig for this custom piece. |
CustomPiece(GameObject, String, Boolean)
Custom piece from a prefab.
Will be added to the provided by name.
Can fix references from Mock<T>s or not.
Will be added to the
Can fix references from Mock<T>s or not.
Declaration
public CustomPiece(GameObject piecePrefab, string pieceTable, bool fixReference)
Parameters
Type | Name | Description |
---|---|---|
GameObject | piecePrefab | The prefab for this custom piece. |
System.String | pieceTable |
Name of the |
System.Boolean | fixReference | If true references for Mock<T> objects get resolved at runtime by Jötunn. |
CustomPiece(String, Boolean, PieceConfig)
Custom piece created as an "empty" primitive with a PieceConfig attached.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
Declaration
public CustomPiece(string name, bool addZNetView, PieceConfig pieceConfig)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new prefab. Must be unique. |
System.Boolean | addZNetView | If true a ZNetView component will be added to the prefab for network sync. |
PieceConfig | pieceConfig | The PieceConfig for this custom piece. |
CustomPiece(String, Boolean, String)
Custom piece created as an "empty" primitive.
Will be added to the provided by name.
Will be added to the
Declaration
public CustomPiece(string name, bool addZNetView, string pieceTable)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new prefab. Must be unique. |
System.Boolean | addZNetView | If true a ZNetView component will be added to the prefab for network sync. |
System.String | pieceTable |
Name of the |
CustomPiece(String, String, PieceConfig)
Custom piece created as a copy of a vanilla Valheim prefab with a PieceConfig attached.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
The members and references from the PieceConfig will be referenced by Jötunn at runtime.
Declaration
public CustomPiece(string name, string baseName, PieceConfig pieceConfig)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The new name of the prefab after cloning. |
System.String | baseName | The name of the base prefab the custom item is cloned from. |
PieceConfig | pieceConfig | The PieceConfig for this custom piece. |
CustomPiece(String, String, String)
Custom piece created as a copy of a vanilla Valheim prefab.
Will be added to the provided by name.
Will be added to the
Declaration
public CustomPiece(string name, string baseName, string pieceTable)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The new name of the prefab after cloning. |
System.String | baseName | The name of the base prefab the custom item is cloned from. |
System.String | pieceTable |
Name of the |
Properties
| Improve this Doc View SourceFixReference
Indicator if references from Mock<T>s will be replaced at runtime.
Declaration
public bool FixReference { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Piece
The component for this custom piece as a shortcut.
Declaration
public Piece Piece { get; }
Property Value
Type | Description |
---|---|
Piece |
PiecePrefab
The prefab for this custom piece.
Declaration
public GameObject PiecePrefab { get; }
Property Value
Type | Description |
---|---|
GameObject |
PieceTable
Name of the this custom piece belongs to.
Declaration
public string PieceTable { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
System.Object.Equals(System.Object)
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
IsCustomPiece(String)
Helper method to determine if a prefab with a given name is a custom piece created with Jötunn.
Declaration
public static bool IsCustomPiece(string prefabName)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefabName | Name of the prefab to test. |
Returns
Type | Description |
---|---|
System.Boolean | true if the prefab is added as a custom piece to the PieceManager. |
IsValid()
Checks if a custom piece is valid (i.e. has a prefab, a target PieceTable is set,
has a component and that component has an icon).
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
System.Boolean | true if all criteria is met |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
System.Object.ToString()