five hundred million if statements
This commit is contained in:
parent
9930aba85d
commit
24ab1b213e
5 changed files with 203 additions and 44 deletions
|
|
@ -21447,6 +21447,46 @@ PrefabInstance:
|
||||||
propertyPath: secondaryIcon
|
propertyPath: secondaryIcon
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1509689679}
|
objectReference: {fileID: 1509689679}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: abilities.Array.size
|
||||||
|
value: 4
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: hotbarIcons.Array.size
|
||||||
|
value: 4
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: 'abilities.Array.data[0]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 8579369158027197764, guid: d695e39a8ed83e67aa09d75b33cf7bb3, type: 3}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: 'abilities.Array.data[1]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 8579369158027197764, guid: fc8f0e7853997c463b72085306621f40, type: 3}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: 'abilities.Array.data[2]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2212103048918046095, guid: 2d849b52879286a90a56fa3955e0adb6, type: 3}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: 'abilities.Array.data[3]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2202756030888818067, guid: 91297fef450704432837e8de1bda05d7, type: 3}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: 'hotbarIcons.Array.data[0]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 8557355471054574495}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: 'hotbarIcons.Array.data[1]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1509689679}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: 'hotbarIcons.Array.data[2]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2040234423}
|
||||||
|
- target: {fileID: 7002501187268097541, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
propertyPath: 'hotbarIcons.Array.data[3]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2065550206}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
|
|
@ -21576,6 +21616,7 @@ Transform:
|
||||||
- {fileID: 1972076835}
|
- {fileID: 1972076835}
|
||||||
- {fileID: 1483226599}
|
- {fileID: 1483226599}
|
||||||
- {fileID: 1432589379}
|
- {fileID: 1432589379}
|
||||||
|
- {fileID: 1516594163}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &446769396
|
--- !u!1 &446769396
|
||||||
|
|
@ -25698,6 +25739,11 @@ MonoBehaviour:
|
||||||
allUpgrades:
|
allUpgrades:
|
||||||
- {fileID: 11400000, guid: 6fe34d7ec95c2ce1fac0727c553b5f0b, type: 2}
|
- {fileID: 11400000, guid: 6fe34d7ec95c2ce1fac0727c553b5f0b, type: 2}
|
||||||
- {fileID: 11400000, guid: 8ba5b877541778773b0434cf7e36cebb, type: 2}
|
- {fileID: 11400000, guid: 8ba5b877541778773b0434cf7e36cebb, type: 2}
|
||||||
|
allAbilities:
|
||||||
|
- {fileID: 8579369158027197764, guid: d695e39a8ed83e67aa09d75b33cf7bb3, type: 3}
|
||||||
|
- {fileID: 8579369158027197764, guid: fc8f0e7853997c463b72085306621f40, type: 3}
|
||||||
|
- {fileID: 2212103048918046095, guid: 2d849b52879286a90a56fa3955e0adb6, type: 3}
|
||||||
|
- {fileID: 2202756030888818067, guid: 91297fef450704432837e8de1bda05d7, type: 3}
|
||||||
--- !u!4 &1432589379
|
--- !u!4 &1432589379
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -26187,6 +26233,52 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 18d0774d0a3b11b43858ef778057d6fe, type: 3}
|
m_Script: {fileID: 11500000, guid: 18d0774d0a3b11b43858ef778057d6fe, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1 &1516594162
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1516594163}
|
||||||
|
- component: {fileID: 1516594164}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: SceneTransferHandler
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1516594163
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1516594162}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 439163859}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1516594164
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1516594162}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 344b6d195bedf2119ae2e445a6511a78, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
savedAbilities: []
|
||||||
|
abilityHandler: {fileID: 394036756}
|
||||||
--- !u!1 &1527669742
|
--- !u!1 &1527669742
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ public class AbilityManager : MonoBehaviour
|
||||||
public Button upgradeButton;
|
public Button upgradeButton;
|
||||||
[Header("Upgrades")]
|
[Header("Upgrades")]
|
||||||
public AbilityUpgrade[] allUpgrades;
|
public AbilityUpgrade[] allUpgrades;
|
||||||
|
public PlayerAbility[] allAbilities;
|
||||||
public Dictionary<AbilityUpgrade, int> upgradesInventory = new();
|
public Dictionary<AbilityUpgrade, int> upgradesInventory = new();
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,14 +54,14 @@ public class AbilityUIHandler : MonoBehaviour
|
||||||
|
|
||||||
public void UpdateAbilitySelection()
|
public void UpdateAbilitySelection()
|
||||||
{
|
{
|
||||||
uiObjects[0].onClick.AddListener(() => ShowAbilityUI(playerAbilityHandler.mainAttackInstance));
|
int currentUIObject = 0;
|
||||||
uiObjects[0].GetComponentInChildren<TextMeshProUGUI>().text = playerAbilityHandler.mainAttackInstance.abilityName;
|
foreach (Button uiObject in uiObjects)
|
||||||
uiObjects[1].onClick.AddListener(() => ShowAbilityUI(playerAbilityHandler.secondaryAttackInstance));
|
{
|
||||||
uiObjects[1].GetComponentInChildren<TextMeshProUGUI>().text = playerAbilityHandler.secondaryAttackInstance.abilityName;
|
var o = currentUIObject;
|
||||||
uiObjects[2].onClick.AddListener(() => ShowAbilityUI(playerAbilityHandler.spellAInstance));
|
uiObject.onClick.AddListener(() => ShowAbilityUI(playerAbilityHandler.abilityInstances[o]));
|
||||||
uiObjects[2].GetComponentInChildren<TextMeshProUGUI>().text = playerAbilityHandler.spellAInstance.abilityName;
|
uiObject.GetComponentInChildren<TextMeshProUGUI>().text = playerAbilityHandler.abilityInstances[o].abilityName;
|
||||||
uiObjects[3].onClick.AddListener(() => ShowAbilityUI(playerAbilityHandler.spellBInstance));
|
currentUIObject++;
|
||||||
uiObjects[3].GetComponentInChildren<TextMeshProUGUI>().text = playerAbilityHandler.spellBInstance.abilityName;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowAbilityUI(PlayerAbility ability)
|
public void ShowAbilityUI(PlayerAbility ability)
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,80 @@ public class AbilitySceneTransfer : MonoBehaviour
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class SavedAbility
|
public class SavedAbility
|
||||||
{
|
{
|
||||||
|
public enum AbilitySlot {Primary, Secondary, SpellA, SpellB}
|
||||||
|
public AbilitySlot abilitySlot = AbilitySlot.Primary;
|
||||||
public string abilityName;
|
public string abilityName;
|
||||||
public Dictionary<string, int> equippedUpgrades;
|
public Dictionary<string, int> equippedUpgrades = new();
|
||||||
}
|
}
|
||||||
public List<SavedAbility> savedAbilities;
|
public List<SavedAbility> savedAbilities;
|
||||||
|
public MarisaAbilityHandler abilityHandler;
|
||||||
|
|
||||||
|
[ContextMenu("Save")]
|
||||||
|
public void TestSaving()
|
||||||
|
{
|
||||||
|
int testSlot = 0;
|
||||||
|
foreach (PlayerAbility ability in abilityHandler.abilityInstances)
|
||||||
|
{
|
||||||
|
SaveAbility(ability);
|
||||||
|
savedAbilities[testSlot].abilitySlot = (SavedAbility.AbilitySlot)testSlot;
|
||||||
|
testSlot++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[ContextMenu("Load")]
|
||||||
|
public void TestLoading()
|
||||||
|
{
|
||||||
|
LoadAbilities();
|
||||||
|
}
|
||||||
public void SaveAbility(PlayerAbility savedAbility)
|
public void SaveAbility(PlayerAbility savedAbility)
|
||||||
{
|
{
|
||||||
savedAbilities.Add(new SavedAbility
|
SavedAbility newSavedAbility = new();
|
||||||
|
newSavedAbility.abilityName = savedAbility.abilityName;
|
||||||
|
foreach (AbilityUpgrade upgrade in AbilityManager.instance.allUpgrades)
|
||||||
{
|
{
|
||||||
abilityName = savedAbility.abilityName
|
int upgradeCount = savedAbility.GetUpgradeCount(upgrade);
|
||||||
});
|
if (upgradeCount > 0)
|
||||||
|
{
|
||||||
|
newSavedAbility.equippedUpgrades[upgrade.upgradeName] = upgradeCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
savedAbilities.Add(newSavedAbility);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadAbilities()
|
||||||
|
{
|
||||||
|
abilityHandler.abilities.Clear();
|
||||||
|
foreach (SavedAbility savedAbility in savedAbilities)
|
||||||
|
{
|
||||||
|
PlayerAbility foundAbility = null;
|
||||||
|
foreach (PlayerAbility ability in AbilityManager.instance.allAbilities)
|
||||||
|
{
|
||||||
|
if (savedAbility.abilityName == ability.abilityName) //shit code
|
||||||
|
{
|
||||||
|
foundAbility = ability;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundAbility)
|
||||||
|
{
|
||||||
|
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.SetupAbilities();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
|
|
@ -6,62 +7,62 @@ public class MarisaAbilityHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private PlayerInput inputHandler;
|
[SerializeField] private PlayerInput inputHandler;
|
||||||
[SerializeField] private Marisa thisPlayer;
|
[SerializeField] private Marisa thisPlayer;
|
||||||
|
|
||||||
[Header("Abilities")] //maybe have to make them public for when you're changing out abilities
|
[Header("Abilities")] //maybe have to make them public for when you're changing out abilities
|
||||||
[SerializeField] private PlayerAbility mainAttack;
|
public List<PlayerAbility> abilities = new();
|
||||||
[SerializeField] private PlayerAbility secondaryAttack;
|
|
||||||
[SerializeField] private PlayerAbility spellA;
|
|
||||||
[SerializeField] private PlayerAbility spellB;
|
|
||||||
|
|
||||||
[Header("Ability Instances")]
|
[Header("Ability Instances")]
|
||||||
public PlayerAbility mainAttackInstance;
|
public List<PlayerAbility> abilityInstances = new();
|
||||||
public PlayerAbility secondaryAttackInstance;
|
|
||||||
public PlayerAbility spellAInstance;
|
|
||||||
public PlayerAbility spellBInstance;
|
|
||||||
|
|
||||||
[Header("UI")]
|
[Header("UI")]
|
||||||
public AbilityHotbarIcon mainIcon;
|
public AbilityHotbarIcon[] hotbarIcons;
|
||||||
public AbilityHotbarIcon secondaryIcon;
|
|
||||||
public AbilityHotbarIcon spellAIcon;
|
|
||||||
public AbilityHotbarIcon spellBIcon;
|
|
||||||
//this is getting ridiculous
|
//this is getting ridiculous
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
mainAttackInstance = Instantiate(mainAttack, transform);
|
SetupAbilities();
|
||||||
mainAttackInstance.thisPlayer = thisPlayer;
|
}
|
||||||
mainIcon.UpdateAbility(mainAttackInstance);
|
|
||||||
secondaryAttackInstance = Instantiate(secondaryAttack, transform);
|
public void SetupAbilities()
|
||||||
secondaryAttackInstance.thisPlayer = thisPlayer;
|
{
|
||||||
secondaryIcon.UpdateAbility(secondaryAttackInstance);
|
foreach (PlayerAbility oldAbility in abilityInstances)
|
||||||
spellAInstance = Instantiate(spellA, transform);
|
{
|
||||||
spellAInstance.thisPlayer = thisPlayer;
|
Destroy(oldAbility.gameObject);
|
||||||
spellAIcon.UpdateAbility(spellAInstance);
|
}
|
||||||
spellBInstance = Instantiate(spellB, transform);
|
abilityInstances.Clear();
|
||||||
spellBInstance.thisPlayer = thisPlayer;
|
int currentAbilityCount = 0;
|
||||||
spellBIcon.UpdateAbility(spellBInstance);
|
foreach (PlayerAbility ability in abilities)
|
||||||
|
{
|
||||||
|
PlayerAbility newAbility = Instantiate(ability, transform);
|
||||||
|
abilityInstances.Add(newAbility);
|
||||||
|
newAbility.thisPlayer = thisPlayer;
|
||||||
|
hotbarIcons[currentAbilityCount].UpdateAbility(newAbility);
|
||||||
|
currentAbilityCount++;
|
||||||
|
Debug.Log(ability.abilityName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (inputHandler.actions["MainAttack"].inProgress)
|
if (inputHandler.actions["MainAttack"].inProgress)
|
||||||
{
|
{
|
||||||
mainAttackInstance.TryAbility();
|
abilityInstances[0].TryAbility();
|
||||||
mainIcon.UpdateCooldown();
|
hotbarIcons[0].UpdateCooldown();
|
||||||
}
|
}
|
||||||
else if (inputHandler.actions["SecondaryAttack"].inProgress)
|
else if (inputHandler.actions["SecondaryAttack"].inProgress)
|
||||||
{
|
{
|
||||||
secondaryAttackInstance.TryAbility();
|
abilityInstances[1].TryAbility();
|
||||||
secondaryIcon.UpdateCooldown();
|
hotbarIcons[1].UpdateCooldown();
|
||||||
}
|
}
|
||||||
else if (inputHandler.actions["SpellA"].inProgress)
|
else if (inputHandler.actions["SpellA"].inProgress)
|
||||||
{
|
{
|
||||||
spellAInstance.TryAbility();
|
abilityInstances[2].TryAbility();
|
||||||
spellAIcon.UpdateCooldown();
|
hotbarIcons[2].UpdateCooldown();
|
||||||
}
|
}
|
||||||
else if (inputHandler.actions["SpellB"].inProgress)
|
else if (inputHandler.actions["SpellB"].inProgress)
|
||||||
{
|
{
|
||||||
spellBInstance.TryAbility();
|
abilityInstances[3].TryAbility();
|
||||||
spellBIcon.UpdateCooldown();
|
hotbarIcons[3].UpdateCooldown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue