this idiot forgot to commit an entire month's worth of code
This commit is contained in:
parent
c67146ea1a
commit
a3321d361c
51 changed files with 3644 additions and 84 deletions
|
|
@ -5,7 +5,7 @@ using UnityEngine.EventSystems;
|
|||
|
||||
public class AbilityHotbarIcon : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[SerializeField] private Transform cooldownBar;
|
||||
public Transform cooldownBar;
|
||||
[SerializeField] private TextMeshProUGUI text;
|
||||
private bool onCooldown;
|
||||
private PlayerAbility thisAbility;
|
||||
|
|
@ -34,6 +34,7 @@ public class AbilityHotbarIcon : MonoBehaviour, IPointerEnterHandler, IPointerEx
|
|||
public void UpdateAbility(PlayerAbility ability)
|
||||
{
|
||||
thisAbility = ability;
|
||||
ability.thisHotbarIcon = this;
|
||||
text.text = thisAbility.abilityName;
|
||||
}
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public class AbilityManager : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
instance = this;
|
||||
DontDestroyOnLoad(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -26,12 +27,23 @@ public class AbilityManager : MonoBehaviour
|
|||
public Button upgradeButton;
|
||||
[Header("Upgrades")]
|
||||
public AbilityUpgrade[] allUpgrades;
|
||||
public PlayerAbility[] allAbilities;
|
||||
[SerializeField] private PlayerAbility[] allAbilities;
|
||||
public Dictionary<String, PlayerAbility> abilityLookup = new();
|
||||
public Dictionary<String, AbilityUpgrade> upgradeLookup = new();
|
||||
public Dictionary<AbilityUpgrade, int> upgradesInventory = new();
|
||||
private void Start()
|
||||
{
|
||||
// upgradeButton.onClick.AddListener((() => AddUpgrade(upgradeToAdd, player.mainAttackInstance)));
|
||||
StoreUpgrade(upgradeToAdd);
|
||||
foreach (PlayerAbility ability in allAbilities)
|
||||
{
|
||||
abilityLookup[ability.abilityName] = ability;
|
||||
}
|
||||
|
||||
foreach (AbilityUpgrade upgrade in allUpgrades)
|
||||
{
|
||||
upgradeLookup[upgrade.upgradeName] = upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreUpgrade(AbilityUpgrade upgradeToStore)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ public class EnemyAbility : ScriptableObject
|
|||
{
|
||||
public float cooldown;
|
||||
public float power;
|
||||
public float range;
|
||||
public float maxRange;
|
||||
public float minRange; //usually zero but might be needed in some cases
|
||||
public virtual void UseAbility(Entity target, Enemy owner)
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ public class PlayerAbility : MonoBehaviour
|
|||
public string abilityName;
|
||||
public Sprite abilityIcon;
|
||||
public Marisa thisPlayer;
|
||||
public AbilityHotbarIcon thisHotbarIcon;
|
||||
[Header("Cooldown")]
|
||||
public bool canCooldown = true;
|
||||
public float baseCooldown;
|
||||
|
|
@ -16,6 +17,7 @@ public class PlayerAbility : MonoBehaviour
|
|||
[Header("Stats")]
|
||||
public float basePower;
|
||||
public float power;
|
||||
public float powerMultiplier; // you need to figure out power.
|
||||
public int baseProjectileCount;
|
||||
public int projectileCount;
|
||||
public Dictionary<AbilityUpgrade, int> attachedUpgrades = new();
|
||||
|
|
|
|||
|
|
@ -5,15 +5,17 @@ public class AbilityUpgrade : ScriptableObject
|
|||
[Header("Identification")]
|
||||
public string upgradeName;
|
||||
public Sprite upgradeIcon;
|
||||
public int rarity; //higher is rarer
|
||||
public int cost;
|
||||
[Header("Stats")]
|
||||
[SerializeField] private string hi; //never use this lol it's just for the header
|
||||
|
||||
public void ApplyUpgrade(PlayerAbility abilityToUpgrade)
|
||||
public void ApplyUpgrade(PlayerAbility abilityToUpgrade, float optionalInput = 0)
|
||||
{
|
||||
UpgradeEffects(abilityToUpgrade);
|
||||
UpgradeEffects(abilityToUpgrade, optionalInput);
|
||||
}
|
||||
|
||||
protected virtual void UpgradeEffects(PlayerAbility abilityToUpgrade)
|
||||
protected virtual void UpgradeEffects(PlayerAbility abilityToUpgrade, float optionalInput)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ public class CooldownUpgrade : AbilityUpgrade
|
|||
{
|
||||
[SerializeField] private float cooldownDifference;
|
||||
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade)
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade, float optionalInput)
|
||||
{
|
||||
abilityToUpgrade.cooldown = abilityToUpgrade.baseCooldown * ((float)Math.Pow(cooldownDifference, abilityToUpgrade.attachedUpgrades[this])); //almost forgot my math there...
|
||||
}
|
||||
|
|
|
|||
19
Assets/Scripts/Abilities/Upgrades/Enemy Count Upgrade.asset
Normal file
19
Assets/Scripts/Abilities/Upgrades/Enemy Count Upgrade.asset
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
%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: ce6ef1d1ae7df5849b3fdee8fc8fcbba, type: 3}
|
||||
m_Name: Enemy Count Upgrade
|
||||
m_EditorClassIdentifier:
|
||||
upgradeName: A name
|
||||
upgradeIcon: {fileID: 0}
|
||||
hi:
|
||||
damageIncreasePercentage: 0.15
|
||||
runtimeObject: {fileID: 7716994186307467207, guid: 6d10c59bff13032f287e544b4c3c19cf, type: 3}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f8b8bce9dd3b28a8fa56648bcb036480
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
48
Assets/Scripts/Abilities/Upgrades/EnemyCountInstance.prefab
Normal file
48
Assets/Scripts/Abilities/Upgrades/EnemyCountInstance.prefab
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &6018690837818724447
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2133486229549973065}
|
||||
- component: {fileID: 7716994186307467207}
|
||||
m_Layer: 0
|
||||
m_Name: EnemyCountInstance
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2133486229549973065
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6018690837818724447}
|
||||
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: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &7716994186307467207
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6018690837818724447}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 54d7053b10fbdd0329fb509aa84129fb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
baseSO: {fileID: 0}
|
||||
thisAbility: {fileID: 0}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6d10c59bff13032f287e544b4c3c19cf
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Scripts/Abilities/Upgrades/EnemyCountPowerup.cs
Normal file
16
Assets/Scripts/Abilities/Upgrades/EnemyCountPowerup.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "Enemy Count Upgrade", menuName = "AbilityUpgrades/EnemyCountUpgrade")]
|
||||
public class EnemyCountPowerup : AbilityUpgrade
|
||||
{
|
||||
public float damageIncreasePercentage;
|
||||
[SerializeField] private EnemyCountRuntime runtimeObject;
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade, float optionalInput)
|
||||
{
|
||||
EnemyCountRuntime newRuntimeObject = Instantiate(runtimeObject, abilityToUpgrade.transform);
|
||||
newRuntimeObject.baseSO = this;
|
||||
newRuntimeObject.thisAbility = abilityToUpgrade;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ce6ef1d1ae7df5849b3fdee8fc8fcbba
|
||||
26
Assets/Scripts/Abilities/Upgrades/EnemyCountRuntime.cs
Normal file
26
Assets/Scripts/Abilities/Upgrades/EnemyCountRuntime.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemyCountRuntime : MonoBehaviour
|
||||
{
|
||||
private List<Collider2D> enemiesInRange = new(); //was supposed to be entity list but trygetcomponent isn't needed because we aren't using the actual entity values
|
||||
public EnemyCountPowerup baseSO;
|
||||
public PlayerAbility thisAbility;
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(tag))
|
||||
{
|
||||
enemiesInRange.Add(other);
|
||||
}
|
||||
thisAbility.powerMultiplier = 1 + baseSO.damageIncreasePercentage * enemiesInRange.Count; //does not stack with other multipliers and must be fixed
|
||||
}
|
||||
|
||||
private void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(tag) && enemiesInRange.Contains(other))
|
||||
{
|
||||
enemiesInRange.Remove(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 54d7053b10fbdd0329fb509aa84129fb
|
||||
18
Assets/Scripts/Abilities/Upgrades/KillCooldown.cs
Normal file
18
Assets/Scripts/Abilities/Upgrades/KillCooldown.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class KillCooldown : AbilityUpgrade
|
||||
{
|
||||
public float damageIncrease;
|
||||
public float cooldownChange;
|
||||
[SerializeField] private KillCooldownRuntimeObject runtimeObject;
|
||||
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade, float optionalInput)
|
||||
{
|
||||
base.UpgradeEffects(abilityToUpgrade, optionalInput);
|
||||
abilityToUpgrade.canCooldown = false;
|
||||
abilityToUpgrade.cooldown = abilityToUpgrade.baseCooldown * cooldownChange;
|
||||
KillCooldownRuntimeObject newRuntimeObject = Instantiate(runtimeObject, abilityToUpgrade.transform);
|
||||
newRuntimeObject.ability = abilityToUpgrade;
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/Upgrades/KillCooldown.cs.meta
Normal file
2
Assets/Scripts/Abilities/Upgrades/KillCooldown.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 70c8f2392635dc77da8d3f4bf9d656c7
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class KillCooldownRuntimeObject : MonoBehaviour
|
||||
{
|
||||
public PlayerAbility ability;
|
||||
private void Start()
|
||||
{
|
||||
Enemy.OnKill += UpdateKills;
|
||||
}
|
||||
|
||||
public void UpdateKills()
|
||||
{
|
||||
ability.currentCooldown -= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c4e5e6da9766bf54d8c2aa3b49966213
|
||||
|
|
@ -3,7 +3,7 @@ using UnityEngine;
|
|||
[CreateAssetMenu(fileName = "Projectile Count Upgrade", menuName = "AbilityUpgrades/ProjectileCountUpgrade")]
|
||||
public class ProjectileCountUpgrade : AbilityUpgrade
|
||||
{
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade)
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade, float optionalInput)
|
||||
{
|
||||
abilityToUpgrade.projectileCount =
|
||||
abilityToUpgrade.baseProjectileCount + abilityToUpgrade.attachedUpgrades[this];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue