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
|
|
@ -62,7 +62,7 @@ public class AbilityManager : MonoBehaviour
|
|||
{
|
||||
upgradesInventory.Remove(upgrade);
|
||||
}
|
||||
ability.AddUpgrade(upgrade);
|
||||
ability.AddUpgrade(upgrade, 1);
|
||||
AbilityUIHandler.instance.UpdateInventory();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,19 @@ public class AbilityUIHandler : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
instance = this;
|
||||
playerAbilityHandler = FindFirstObjectByType<MarisaAbilityHandler>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
[Header("Abilities")]
|
||||
public List<Button> uiObjects = new();
|
||||
[SerializeField] private MarisaAbilityHandler playerAbilityHandler;
|
||||
private MarisaAbilityHandler playerAbilityHandler;
|
||||
[SerializeField] private AbilityUIObject abilityUI;
|
||||
|
||||
[Header("Upgrades")]
|
||||
[SerializeField] private Transform upgradeGrid;
|
||||
[SerializeField] private StoredAbilityUpgradeUI templateStoredUpgradeUI;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UpdateAbilitySelection();
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ public class PlayerAbility : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
public void AddUpgrade(AbilityUpgrade upgrade)
|
||||
public void AddUpgrade(AbilityUpgrade upgrade, int amount)
|
||||
{
|
||||
if (!attachedUpgrades.ContainsKey(upgrade))
|
||||
{
|
||||
attachedUpgrades[upgrade] = 0;
|
||||
}
|
||||
attachedUpgrades[upgrade]++;
|
||||
attachedUpgrades[upgrade] += amount;
|
||||
upgrade.ApplyUpgrade(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,13 @@ public class EnemySpawner : MonoBehaviour
|
|||
SpawnEnemy(enemiesToSpawn[Random.Range(0, enemiesToSpawn.Length)], spawnPoints[Random.Range(0, spawnPoints.Count)].position);
|
||||
}
|
||||
}
|
||||
else if (!canSpawn && bossEnemy)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.E))
|
||||
{
|
||||
LevelSwitcher.instance.LoadShop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Enemy SpawnEnemy(Enemy enemy, Vector3 location)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class LevelSwitcher : MonoBehaviour
|
||||
{
|
||||
|
|
@ -14,13 +15,36 @@ public class LevelSwitcher : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
instance = this;
|
||||
DontDestroyOnLoad(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public int[] stages; //uhh....
|
||||
public int currentStage;
|
||||
[SerializeField] private int uiStage;
|
||||
[SerializeField] private int shopStage;
|
||||
|
||||
|
||||
[ContextMenu("Load Shop")]
|
||||
public void LoadShop()
|
||||
{
|
||||
AbilitySceneTransfer.instance.SaveAllAbilities();
|
||||
SceneManager.LoadScene(shopStage);
|
||||
SceneManager.LoadScene(uiStage, LoadSceneMode.Additive);
|
||||
SetupScene();
|
||||
}
|
||||
public void ChangeLevel()
|
||||
{
|
||||
|
||||
currentStage++;
|
||||
AbilitySceneTransfer.instance.SaveAllAbilities();
|
||||
SceneManager.LoadScene(stages[currentStage]);
|
||||
SceneManager.LoadScene(uiStage, LoadSceneMode.Additive);
|
||||
SetupScene();
|
||||
}
|
||||
|
||||
public void SetupScene()
|
||||
{
|
||||
AbilitySceneTransfer.instance.abilityHandler = FindFirstObjectByType<MarisaAbilityHandler>();
|
||||
AbilitySceneTransfer.instance.LoadAbilities();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue