# Scripting References

{% hint style="info" %}
<mark style="color:orange;">namespace</mark> **TinyGiantStudio.Ranks**
{% endhint %}

Everything is controlled by the RanksAnimationController.cs file.

## <mark style="color:green;">Public Variables</mark>

<table data-full-width="true"><thead><tr><th width="320.33335367838544">Variable</th><th>Description</th></tr></thead><tbody><tr><td><pre class="language-csharp"><code class="lang-csharp">int defaultSpawnAnimation;
</code></pre></td><td>The default animation that plays when this GameObject spawns or becomes active.<br><br>0 is none, 1 is breathing, and others are different spawn animations.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">List&#x3C;Rank> ranks;
</code></pre></td><td>List of all Ranks.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">int currentRankIndex;
</code></pre></td><td>When a new rank is applied, its index in the ranks list is compared to this value and is used to determine whether to call Upgrade or Downgrade particles. </td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">Rank currentRank;
</code></pre></td><td>It is a copy of the last applied rank, plus any modifications made manually. <br><br>When applying a new rank, some rank variables don't need to be copied from the ranks list. So, if you require accurate information, getting the rank from the ranks list is better.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">Body[] bodies;
</code></pre></td><td>A list of all borders with their supported insides and correct position, and rotation for wings.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">Wing[] wings;
</code></pre></td><td>A list of everything required for wings to work.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">Material[] materials;
</code></pre></td><td>An array of materials that are available as a shortcut in the Customize tab. Different methods can use the index of these materials to set them to the border, the inside, and the wings.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">bool enableUpgradeEffect;
</code></pre></td><td></td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">ParticleSystem upgradeParticle; 
</code></pre></td><td></td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">VisualEffect upgradeVisualEffect;
</code></pre></td><td></td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">bool enableDowngradeEffect;
</code></pre></td><td></td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">ParticleSystem downgradeParticle;
</code></pre></td><td></td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">VisualEffect downgradeVisualEffect;
</code></pre></td><td></td></tr></tbody></table>

## <mark style="color:green;">Methods</mark>

<table data-full-width="true"><thead><tr><th width="402.33335367838544">Method</th><th>Description</th></tr></thead><tbody><tr><td><pre class="language-csharp"><code class="lang-csharp">PlaySpawnAnimation(int target)
</code></pre></td><td>Plays an animation on the animator on the root of the game object.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"><strong>ApplyRank(int index)
</strong></code></pre></td><td><p>Retrieves the rank from the ranks list at the specified index and applies it.</p><p><br>If an invalid index is passed, it logs a warning message and returns. Doesn't print an error.</p></td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"><strong>ApplyRank(string rankName)
</strong></code></pre></td><td>Applies a rank from the ranks list by its exact name.<br><br>If the rank is not found or the name is invalid, a warning is logged.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"><strong>ApplyRank(Rank targetRank)
</strong></code></pre></td><td>Applies the rank passed as parameter.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetIcon(Rank targetRank);
</code></pre></td><td>Applies icon with the target rank's settings.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetIcon(int icon);
</code></pre></td><td>Applies icon with the currentRank's animation settings.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">DisableIcon()
</code></pre></td><td>Removes icon. This is same as calling SetIcon(0);</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetIconDirectly(int icon);
</code></pre></td><td>It applies the icon skipping any animation settings in the current rank.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetIconPrimaryMaterial(int i)
</code></pre></td><td>Retrieves the appropriate material from the materials list based on the given index and applies it to the icon.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetIconPrimaryMaterial(Material material)
</code></pre></td><td>Applies the material passed as parameter to the icon.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetIconSecondaryMaterial(int i)
</code></pre></td><td>Retrieves the appropriate material from the materials list based on the given index and applies it to the icon.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetIconSecondaryMaterial(Material material)
</code></pre></td><td>Applies the material passed as parameter to the icon.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">DisableBorder()
</code></pre></td><td>Removes border and inside.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetBorder(int newBorder, 
bool autoUpdateInside = true, 
bool autoUpdateWingsPosition = true)
</code></pre></td><td>Updates the border with the currentRank's border animation setting.<br><br>Parameters:<br><br><strong>int newBorder</strong><br>Will disable the border if a negative value is passed as a parameter.<br><br><strong>bool autoUpdateInside = true</strong><br>If the current inside isn't viable for the new border, auto update will assign a new one.<br><br><strong>bool autoUpdateWingsPosition = true</strong><br>If wings are changed along with this, set it false so that this doesn't handle updating the position and changing wings updates that.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetBorderMaterials(int i)
</code></pre></td><td>Retrieves the appropriate material from the materials list based on the given index and applies it to the border</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetBorderMaterials(Material material)
</code></pre></td><td>Applies the material passed as parameter to the border.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">DisableInside()
</code></pre></td><td>Removes inside.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetInside(int i)
</code></pre></td><td>Applies new inside according to currentRank's animation settings.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp">SetInside(Inside newInside)
</code></pre></td><td>Applies new inside according to currentRank's animation settings.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"> SetInsideMaterial(int i)
</code></pre></td><td>Retrieves the appropriate material from the materials list based on the given index and applies it to the inside</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"> SetInsideMaterial(Material material)
</code></pre></td><td>Applies the material passed as parameter to the inside.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"> DisableWings()
</code></pre></td><td>Removes Wings</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"> SetWing(int i)
</code></pre></td><td></td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"> SetWingsMaterial(int i)
</code></pre></td><td>Retrieves the appropriate material from the materials list based on the given index and applies it to the wings</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"> SetWingsMaterial(Material mat)
</code></pre></td><td>Applies the material passed as parameter to the wings.</td></tr><tr><td><pre class="language-csharp"><code class="lang-csharp"> DisableEverything()
</code></pre></td><td>Removes icon, border, inside and wings.</td></tr></tbody></table>

