public void ApplyStatusEffect(StatusEffect statusEffect) { //If the player has that status effect already, refresh the duration if (m_statusEffects.ContainsKey(statusEffect.hoveredTitle)) { Debug.Log("Duration of " + statusEffect.hoveredTitle + " is refreshed"); //Refresh the duration of the status effect currently applied on the player m_statusEffects[statusEffect.hoveredTitle].RefreshDuration(); } else { Debug.Log("Applied: " + statusEffect.hoveredTitle); //Create a copy of the status effect StatusEffect newStatusEffect = ScriptableObject.CreateInstance <StatusEffect>(); newStatusEffect.CopyFrom(statusEffect); //Apply the status effect copy to the player m_statusEffects[newStatusEffect.hoveredTitle] = newStatusEffect; newStatusEffect.OnApplied(this); } }