Table of Contents

Class VisualPartInfo

Namespace
PolyMod
Assembly
PolyMod.dll

The description of one visual part of a prefab, as mod JSON gives it.

public class VisualPartInfo
Inheritance
VisualPartInfo
Inherited Members

Fields

coordinates

The world position of the visual part.

[JsonInclude]
public Vector2 coordinates

Field Value

Vector2

defaultSpriteName

The default sprite name of the visual part. PolyMod also uses it as the name of the visual part object.

[JsonInclude]
public string? defaultSpriteName

Field Value

string

improvementSkinningLogic

The logic that selects the skin of the sprite for an improvement. The default is FoundingTribe. Only improvements use this value.

[JsonInclude]
[JsonConverter(typeof(EnumNameJson<SkinVisualsReference.ImprovementSkinningLogic>))]
public SkinVisualsReference.ImprovementSkinningLogic improvementSkinningLogic

Field Value

SkinVisualsReference.ImprovementSkinningLogic

levels

The flag that makes the sprite change with the level of the improvement. Only improvements use this value.

[JsonInclude]
public bool levels

Field Value

bool

outlineSortingOrderOverride

The sorting order of the outline renderer, or null to use the calculated sorting order. Only unit prefabs use this value.

[JsonInclude]
public int? outlineSortingOrderOverride

Field Value

int?

rotation

The rotation of the visual part around the z axis, in degrees.

[JsonInclude]
public float rotation

Field Value

float

skinningLogic

The logic that selects the skin of the sprite. The default is UseTribe.

[JsonInclude]
[JsonConverter(typeof(EnumNameJson<SkinVisualsReference.SkinningLogic>))]
public SkinVisualsReference.SkinningLogic skinningLogic

Field Value

SkinVisualsReference.SkinningLogic

sortingOrderOverride

The sorting order of the visual part renderer, or null to use the calculated sorting order. Only unit prefabs use this value.

[JsonInclude]
public int? sortingOrderOverride

Field Value

int?

tintable

The flag that lets the game tint the sprite with the team color.

[JsonInclude]
public bool tintable

Field Value

bool

Methods

CopyFromVisualPart(VisualPart)

Sets all values of this description from a game visual part.

public void CopyFromVisualPart(SkinVisualsReference.VisualPart visualPart)

Parameters

visualPart SkinVisualsReference.VisualPart

The visual part to copy. Its visual part object must not be null.

Remarks

The sorting orders come from the SpriteRenderer of the visual part object and of the outline object. If an object has no SpriteRenderer, its sorting order is null. coordinates gets the world position of the visual part object. rotation gets the world rotation of the visual part object around the z axis, in degrees.

ToVisualPart(bool)

Makes a game visual part from this description.

public SkinVisualsReference.VisualPart ToVisualPart(bool isImprovement)

Parameters

isImprovement bool

True to mark the visual part as an improvement part.

Returns

SkinVisualsReference.VisualPart

The new visual part.

Remarks

The method copies the sprite name, the tint flag, the skin logic values, and the level flag. It does not make the objects or the renderers of the visual part.