/// <summary>
    /// Select a skill.
    /// </summary>
    /// <param name="skill"> The skill being selected. </param>
    public void SkillSelection(BaseSkill skill, SkillButton button)
    {
        if (ParticlesManager.m_Instance.m_ActiveSkill != null)        // || (ParticlesManager.m_Instance.m_ActiveSkill.m_Skill != null && ParticlesManager.m_Instance.m_ActiveSkill.m_Targets != null))
        {
            Debug.LogWarning($"<color=#9c4141>[Skill]</color> {ParticlesManager.m_Instance.m_ActiveSkill.m_Skill.m_SkillName} is currently active!");
            return;
        }
        // Don't allow progress if the character is an enemy (player can mouse over for info, but not use the skill)
        if (m_SelectedUnit.GetAllegiance() == Allegiance.Enemy)
        {
            return;
        }

        // Make sure the player has a unit selected.
        if (m_SelectedUnit != null)
        {
            // Check if the skill being cast is the heal skill.
            HealSkill hs = skill as HealSkill;
            if (hs != null)
            {
                // Check if this unit has Pestilence's passive (should be Pestilence but you never know).
                PestilencePassive pesPassive = m_SelectedUnit.GetPassiveSkill() as PestilencePassive;
                if (pesPassive != null)
                {
                    // If there is no heal resource remaining, output warning about it and leave function.
                    if (pesPassive.GetHealResource() < pesPassive.m_HealResourceCastCost)
                    {
                        Debug.LogWarning("Not enough heal resource for Pestilence to heal with.");
                        return;
                    }
                }
            }

            // Make sure the unit can afford to cast the skill and the skill isn't on cooldown before selecting it.
            // Just in case.
            if (m_SelectedUnit.GetActionPoints() >= skill.m_Cost && skill.GetCurrentCooldown() == 0)
            {
                foreach (SkillButton b in UIManager.m_Instance.m_SkillSlots)
                {
                    b.m_LightningImage.materialForRendering.SetFloat("_UIVerticalPan", 0);
                }
                button.m_LightningImage.materialForRendering.SetFloat("_UIVerticalPan", 1);

                // Update the GameManager's fields
                m_SelectedSkill  = skill;
                m_TargetingState = TargetingState.Skill;

                // Get the new affectable area.
                m_maxSkillRange = Grid.m_Instance.GetNodesWithinRadius(m_SelectedSkill.m_CastableDistance + m_SelectedSkill.m_AffectedRange, Grid.m_Instance.GetNode(m_SelectedUnit.transform.position), true);

                UpdateSkillPreview(null);
            }
        }
    }