i believe my pc has been set ablaze
This commit is contained in:
parent
24ab1b213e
commit
c67146ea1a
10 changed files with 178 additions and 123 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ public class AbilitySceneTransfer : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
DontDestroyOnLoad(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -31,7 +32,7 @@ public class AbilitySceneTransfer : MonoBehaviour
|
|||
public MarisaAbilityHandler abilityHandler;
|
||||
|
||||
[ContextMenu("Save")]
|
||||
public void TestSaving()
|
||||
public void SaveAllAbilities()
|
||||
{
|
||||
int testSlot = 0;
|
||||
foreach (PlayerAbility ability in abilityHandler.abilityInstances)
|
||||
|
|
@ -46,6 +47,7 @@ public class AbilitySceneTransfer : MonoBehaviour
|
|||
{
|
||||
LoadAbilities();
|
||||
}
|
||||
|
||||
public void SaveAbility(PlayerAbility savedAbility)
|
||||
{
|
||||
SavedAbility newSavedAbility = new();
|
||||
|
|
@ -72,7 +74,7 @@ public class AbilitySceneTransfer : MonoBehaviour
|
|||
if (savedAbility.abilityName == ability.abilityName) //shit code
|
||||
{
|
||||
foundAbility = ability;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -80,22 +82,25 @@ public class AbilitySceneTransfer : MonoBehaviour
|
|||
{
|
||||
Debug.LogWarning($"{savedAbility.abilityName} was not found.");
|
||||
}
|
||||
switch (savedAbility.abilitySlot)
|
||||
{
|
||||
case SavedAbility.AbilitySlot.Primary :
|
||||
abilityHandler.abilities[0] = foundAbility;
|
||||
break;
|
||||
case SavedAbility.AbilitySlot.Secondary :
|
||||
abilityHandler.abilities[1] = foundAbility;
|
||||
break;
|
||||
case SavedAbility.AbilitySlot.SpellA :
|
||||
abilityHandler.abilities[2] = foundAbility;
|
||||
break;
|
||||
case SavedAbility.AbilitySlot.SpellB :
|
||||
abilityHandler.abilities[3] = foundAbility;
|
||||
break;
|
||||
}
|
||||
abilityHandler.abilities.Add(foundAbility);
|
||||
}
|
||||
abilityHandler.SetupAbilities();
|
||||
foreach (PlayerAbility abilityInstance in abilityHandler.abilityInstances)
|
||||
{
|
||||
foreach (SavedAbility savedAbility in savedAbilities)
|
||||
{
|
||||
if (savedAbility.abilityName == abilityInstance.abilityName) //shit code
|
||||
{
|
||||
foreach (AbilityUpgrade upgrade in AbilityManager.instance.allUpgrades)
|
||||
{
|
||||
if (savedAbility.equippedUpgrades[upgrade.upgradeName] > 0)
|
||||
{
|
||||
abilityInstance.AddUpgrade(upgrade, savedAbility.equippedUpgrades[upgrade.upgradeName]);
|
||||
}
|
||||
} //this is REALLY BAD.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue