yeah you're going straight to hell
This commit is contained in:
parent
11d1cbb543
commit
e30de274c8
15 changed files with 3061 additions and 913 deletions
18
Assets/Prefabs/Projectile Count Upgrade.asset
Normal file
18
Assets/Prefabs/Projectile Count Upgrade.asset
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: abe88be260cd4b175b742754eaee097f, type: 3}
|
||||
m_Name: Projectile Count Upgrade
|
||||
m_EditorClassIdentifier:
|
||||
upgradeName: Projectile Count Upgrade
|
||||
upgradeIcon: {fileID: 0}
|
||||
thisPlayerAbility: {fileID: 0}
|
||||
count: 1
|
||||
8
Assets/Prefabs/Projectile Count Upgrade.asset.meta
Normal file
8
Assets/Prefabs/Projectile Count Upgrade.asset.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6fe34d7ec95c2ce1fac0727c553b5f0b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load diff
66
Assets/Scripts/AbilityManager.cs
Normal file
66
Assets/Scripts/AbilityManager.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class AbilityManager : MonoBehaviour
|
||||
{
|
||||
#region Statication
|
||||
|
||||
public static AbilityManager instance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance != null && instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
public MarisaAbilityHandler player;
|
||||
public AbilityUpgrade upgradeToAdd;
|
||||
public Button upgradeButton;
|
||||
private void Start()
|
||||
{
|
||||
upgradeButton.onClick.AddListener((() => AddUpgrade(upgradeToAdd, player.mainAttackInstance)));
|
||||
}
|
||||
|
||||
public void AddUpgrade(AbilityUpgrade upgrade, PlayerAbility ability)
|
||||
{
|
||||
if (!ability.attachedUpgrades.Contains(upgrade))
|
||||
{
|
||||
AbilityUpgrade newUpgrade = Instantiate(upgrade, ability.transform);
|
||||
ability.attachedUpgrades.Add(newUpgrade);
|
||||
newUpgrade.thisPlayerAbility = ability;
|
||||
newUpgrade.ApplyUpgrade();
|
||||
}
|
||||
else
|
||||
{
|
||||
ability.attachedUpgrades.TryGetValue(upgrade, out AbilityUpgrade foundUpgrade);
|
||||
if (foundUpgrade)
|
||||
{
|
||||
foundUpgrade.count++;
|
||||
foundUpgrade.ApplyUpgrade();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveUpgrade(AbilityUpgrade upgrade, PlayerAbility ability)
|
||||
{
|
||||
if (ability.attachedUpgrades.TryGetValue(upgrade, out AbilityUpgrade foundUpgrade))
|
||||
{
|
||||
if (foundUpgrade.count > 1)
|
||||
{
|
||||
foundUpgrade.ApplyRemoval();
|
||||
foundUpgrade.count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
foundUpgrade.ApplyRemoval();
|
||||
ability.attachedUpgrades.Remove(foundUpgrade);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/AbilityManager.cs.meta
Normal file
2
Assets/Scripts/AbilityManager.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1536116e866f6604e8d93d80bb9a6237
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AbilityUIHandler : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
public List<AbilityUIObject> uiObjects = new();
|
||||
|
||||
[SerializeField] private MarisaAbilityHandler playerAbilityHandler;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
uiObjects[0].thisAbility = playerAbilityHandler.mainAttackInstance;
|
||||
uiObjects[1].thisAbility = playerAbilityHandler.secondaryAttackInstance;
|
||||
uiObjects[2].thisAbility = playerAbilityHandler.spellAInstance;
|
||||
uiObjects[3].thisAbility = playerAbilityHandler.spellBInstance;
|
||||
foreach (AbilityUIObject uiObject in uiObjects)
|
||||
{
|
||||
|
||||
uiObject.UpdateUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,24 +8,45 @@ public class AbilityUIObject : MonoBehaviour
|
|||
[Header("Ability Identification")]
|
||||
[SerializeField] private Image abilityIcon;
|
||||
[SerializeField] private TextMeshProUGUI abilityName;
|
||||
|
||||
[Header("Ability Stats")]
|
||||
[SerializeField] private TextMeshProUGUI damage;
|
||||
[SerializeField] private TextMeshProUGUI fireRate;
|
||||
[SerializeField] private TextMeshProUGUI piercing;
|
||||
[SerializeField] private TextMeshProUGUI projectileCount;
|
||||
[Header("Upgrades")]
|
||||
[SerializeField] private List<Transform> upgradeBoxes = new();
|
||||
[SerializeField] private UpgradeBoxUI templateUpgradeBox;
|
||||
[SerializeField] private Transform upgradeGrid;
|
||||
[SerializeField] private List<UpgradeBoxUI> upgradeBoxes = new();
|
||||
|
||||
public void UpdateUI(PlayerAbility ability)
|
||||
public PlayerAbility thisAbility;
|
||||
|
||||
public void UpdateUI()
|
||||
{
|
||||
abilityIcon.sprite = ability.abilityIcon;
|
||||
abilityName.text = ability.abilityName;
|
||||
damage.text = $"Damage: {ability.power}";
|
||||
fireRate.text = $"Fire rate: {ability.cooldown}s";
|
||||
if (ability.TryGetComponent(out FireBullet isBullet))
|
||||
abilityIcon.sprite = thisAbility.abilityIcon;
|
||||
abilityName.text = thisAbility.abilityName;
|
||||
damage.text = $"Damage: {thisAbility.power}";
|
||||
fireRate.text = $"Fire rate: {thisAbility.cooldown}s";
|
||||
if (thisAbility.TryGetComponent(out FireBullet isBullet))
|
||||
{
|
||||
piercing.text = $"Piercing: {isBullet.pierceAmount}";
|
||||
projectileCount.text = $"Projectiles: {isBullet.projectileCount}";
|
||||
}
|
||||
}
|
||||
|
||||
public void AddUpgradeBox(AbilityUpgrade upgrade)
|
||||
{
|
||||
UpgradeBoxUI newBox = Instantiate(templateUpgradeBox, upgradeGrid);
|
||||
upgradeBoxes.Add(newBox);
|
||||
newBox.upgradeImage.sprite = upgrade.upgradeIcon;
|
||||
newBox.UpdateCounter();
|
||||
}
|
||||
|
||||
public void UpdateUpgradeBoxes()
|
||||
{
|
||||
foreach (UpgradeBoxUI box in upgradeBoxes)
|
||||
{
|
||||
box.UpdateCounter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,22 @@ public class AbilityUpgrade : ScriptableObject
|
|||
{
|
||||
[Header("Identification")]
|
||||
public string upgradeName;
|
||||
public Sprite upgradeIcon;
|
||||
public PlayerAbility thisPlayerAbility;
|
||||
[Header("Stats")]
|
||||
public int count = 1;
|
||||
|
||||
public virtual void ApplyUpgrade()
|
||||
{
|
||||
UpgradeEffects();
|
||||
}
|
||||
|
||||
protected virtual void UpgradeEffects()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ApplyRemoval()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ public class FireBullet : PlayerAbility
|
|||
public enum FireMode {Angled, Offset};
|
||||
[Header("Projectile")]
|
||||
public FireMode fireMode = FireMode.Offset;
|
||||
public float projectileCount;
|
||||
public Vector2 offset;
|
||||
public float angle;
|
||||
[SerializeField] private Projectile projectile;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class MarisaAbilityHandler : MonoBehaviour
|
|||
public PlayerAbility spellAInstance;
|
||||
public PlayerAbility spellBInstance;
|
||||
|
||||
private void Start()
|
||||
private void Awake()
|
||||
{
|
||||
mainAttackInstance = Instantiate(mainAttack, transform);
|
||||
mainAttackInstance.thisPlayer = thisPlayer;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerAbility : MonoBehaviour
|
||||
|
|
@ -13,6 +14,8 @@ public class PlayerAbility : MonoBehaviour
|
|||
private float currentCooldown;
|
||||
[Header("Stats")]
|
||||
public float power;
|
||||
public float projectileCount;
|
||||
public HashSet<AbilityUpgrade> attachedUpgrades = new();
|
||||
|
||||
public void TryAbility()
|
||||
{
|
||||
|
|
|
|||
10
Assets/Scripts/ProjectileCountUpgrade.cs
Normal file
10
Assets/Scripts/ProjectileCountUpgrade.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "Projectile Count Upgrade", menuName = "AbilityUpgrades/ProjectileCountUpgrade")]
|
||||
public class ProjectileCountUpgrade : AbilityUpgrade
|
||||
{
|
||||
protected override void UpgradeEffects()
|
||||
{
|
||||
thisPlayerAbility.projectileCount++; //idk how this will work for the stacking.
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/ProjectileCountUpgrade.cs.meta
Normal file
2
Assets/Scripts/ProjectileCountUpgrade.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: abe88be260cd4b175b742754eaee097f
|
||||
14
Assets/Scripts/UpgradeBoxUI.cs
Normal file
14
Assets/Scripts/UpgradeBoxUI.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UpgradeBoxUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TextMeshProUGUI counterUI;
|
||||
public Image upgradeImage;
|
||||
public AbilityUpgrade thisAbilityUpgrade;
|
||||
public void UpdateCounter()
|
||||
{
|
||||
counterUI.text = $"x{thisAbilityUpgrade.count}";
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UpgradeBoxUI.cs.meta
Normal file
2
Assets/Scripts/UpgradeBoxUI.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b89f179fefb96497c879d4a8dd635717
|
||||
Loading…
Add table
Add a link
Reference in a new issue