the scarlet police have me at gun point
This commit is contained in:
parent
b964c9b617
commit
d6da52fd69
54 changed files with 674 additions and 55 deletions
|
|
@ -25,6 +25,8 @@ public class FireBullet : PlayerAbility
|
|||
{
|
||||
newProjectile.transform.position += new Vector3(Random.Range(-offset.x, offset.x), Random.Range(-offset.y, offset.y));
|
||||
}
|
||||
|
||||
newProjectile.owner = thisPlayer;
|
||||
newProjectile.pierceAmount = pierceAmount;
|
||||
newProjectile.damage = power;
|
||||
newProjectile.speed = projectileSpeed;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class Laser : PlayerAbility
|
|||
enemyList.Remove(enemy);
|
||||
continue;
|
||||
}
|
||||
enemy.TakeDamage(power);
|
||||
enemy.TakeDamage(power, thisPlayer);
|
||||
}
|
||||
currentDebounce = damageDebounceTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class NondirectionalLaser : Laser
|
|||
enemyList.Remove(enemy);
|
||||
continue;
|
||||
}
|
||||
enemy.TakeDamage(power);
|
||||
enemy.TakeDamage(power, thisPlayer);
|
||||
}
|
||||
currentDebounce = damageDebounceTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,13 +10,23 @@ public class PlayerAbility : MonoBehaviour
|
|||
public Marisa thisPlayer;
|
||||
[Header("Cooldown")]
|
||||
public bool canCooldown = true;
|
||||
public float baseCooldown;
|
||||
public float cooldown;
|
||||
public float currentCooldown;
|
||||
[Header("Stats")]
|
||||
[Header("Stats")]
|
||||
public float basePower;
|
||||
public float power;
|
||||
public float baseProjectileCount;
|
||||
public float projectileCount;
|
||||
public Dictionary<AbilityUpgrade, int> attachedUpgrades = new();
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
cooldown = baseCooldown;
|
||||
power = basePower;
|
||||
projectileCount = baseProjectileCount;
|
||||
}
|
||||
|
||||
public void TryAbility()
|
||||
{
|
||||
if (currentCooldown <= 0 && canCooldown)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ public class AbilityUpgrade : ScriptableObject
|
|||
[Header("Identification")]
|
||||
public string upgradeName;
|
||||
public Sprite upgradeIcon;
|
||||
[Header("Stats")]
|
||||
public PlayerAbility thisPlayerAbility;
|
||||
[Header("Stats")]
|
||||
[SerializeField] private string hi; //never use this lol it's just for the header
|
||||
|
||||
public void ApplyUpgrade(PlayerAbility abilityToUpgrade)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class AttackSpeedUpgrade : AbilityUpgrade
|
||||
{
|
||||
[SerializeField] private float speedUpgradeAmount;
|
||||
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade)
|
||||
{
|
||||
thisPlayerAbility.cooldown *= speedUpgradeAmount;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8cf716a335ed64e9c9c64a9e934acbd8
|
||||
13
Assets/Scripts/Abilities/Upgrades/CooldownUpgrade.cs
Normal file
13
Assets/Scripts/Abilities/Upgrades/CooldownUpgrade.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "Cooldown Upgrade", menuName = "AbilityUpgrades/CooldownUpgrade")]
|
||||
public class CooldownUpgrade : AbilityUpgrade
|
||||
{
|
||||
[SerializeField] private float cooldownDifference;
|
||||
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade)
|
||||
{
|
||||
abilityToUpgrade.cooldown = abilityToUpgrade.baseCooldown * ((float)Math.Pow(cooldownDifference, abilityToUpgrade.attachedUpgrades[this])); //almost forgot my math there...
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e80971b6dc38dd3bf84fc18ed9696f15
|
||||
|
|
@ -5,6 +5,7 @@ public class ProjectileCountUpgrade : AbilityUpgrade
|
|||
{
|
||||
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade)
|
||||
{
|
||||
abilityToUpgrade.projectileCount++; //idk how this will work for the stacking.
|
||||
abilityToUpgrade.projectileCount =
|
||||
abilityToUpgrade.baseProjectileCount + abilityToUpgrade.attachedUpgrades[this];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
8
Assets/Scripts/Effects.meta
Normal file
8
Assets/Scripts/Effects.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 94cc9fe8fcb5ad3758a0862faf634c2e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/Scripts/Effects/Effect.cs
Normal file
26
Assets/Scripts/Effects/Effect.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class Effect : ScriptableObject
|
||||
{
|
||||
[SerializeField] private EffectInstance effectInstanceObject;
|
||||
[Header("Stats")]
|
||||
public float duration;
|
||||
public bool isConstant; //that means if it uses the tick function or not
|
||||
|
||||
public virtual void ApplyEffect(Entity affectedEntity)
|
||||
{
|
||||
EffectInstance newEffectInstance = Instantiate(effectInstanceObject, affectedEntity.transform);
|
||||
newEffectInstance.affectedEntity = affectedEntity;
|
||||
|
||||
}
|
||||
|
||||
public virtual void EffectTick(Entity affectedEntity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void RemoveEffect(Entity affectedEntity)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Effects/Effect.cs.meta
Normal file
2
Assets/Scripts/Effects/Effect.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c83f7c791d22a8317bdf4351fbcd97a0
|
||||
22
Assets/Scripts/Effects/EffectInstance.cs
Normal file
22
Assets/Scripts/Effects/EffectInstance.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class EffectInstance : MonoBehaviour
|
||||
{
|
||||
public Effect thisEffect;
|
||||
public Entity affectedEntity;
|
||||
public float timeElapsed;
|
||||
private void Update()
|
||||
{
|
||||
timeElapsed += Time.deltaTime;
|
||||
if (timeElapsed > thisEffect.duration)
|
||||
{
|
||||
thisEffect.RemoveEffect(affectedEntity);
|
||||
return;
|
||||
}
|
||||
if (thisEffect.isConstant)
|
||||
{
|
||||
thisEffect.EffectTick(affectedEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Effects/EffectInstance.cs.meta
Normal file
2
Assets/Scripts/Effects/EffectInstance.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d9461c5d5a30726ac8395e724c006d73
|
||||
|
|
@ -113,9 +113,9 @@ public class Enemy : Entity
|
|||
}
|
||||
}
|
||||
|
||||
public override void TakeDamage(float damage)
|
||||
public override void TakeDamage(float damage, Entity origin)
|
||||
{
|
||||
base.TakeDamage(damage);
|
||||
base.TakeDamage(damage, origin);
|
||||
OnDamaged?.Invoke();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ public class EnemyFireBullet : EnemyAbility
|
|||
{
|
||||
newProjectile.transform.position += new Vector3(Random.Range(-offset.x, offset.x), Random.Range(-offset.y, offset.y));
|
||||
}
|
||||
|
||||
newProjectile.owner = owner;
|
||||
newProjectile.pierceAmount = pierceAmount;
|
||||
newProjectile.damage = power;
|
||||
newProjectile.speed = projectileSpeed;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class Entity : MonoBehaviour
|
|||
rb.linearVelocity = moveDirection * speed;
|
||||
}
|
||||
}
|
||||
public virtual void TakeDamage(float damage)
|
||||
public virtual void TakeDamage(float damage, Entity origin)
|
||||
{
|
||||
health -= damage;
|
||||
if (health < 0)
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ public class Marisa : Entity
|
|||
base.FixedUpdate();
|
||||
}
|
||||
|
||||
public override void TakeDamage(float damage)
|
||||
public override void TakeDamage(float damage, Entity origin)
|
||||
{
|
||||
base.TakeDamage(damage);
|
||||
base.TakeDamage(damage, origin);
|
||||
UpdateHealthUI();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using UnityEngine;
|
|||
|
||||
public class Projectile : MonoBehaviour
|
||||
{
|
||||
public Entity owner;
|
||||
public float damage;
|
||||
public float speed;
|
||||
private int currentPierced;
|
||||
|
|
@ -30,7 +31,7 @@ public class Projectile : MonoBehaviour
|
|||
{
|
||||
if (!other.CompareTag(tag) && other.TryGetComponent(out Entity isEntity))
|
||||
{
|
||||
isEntity.TakeDamage(damage);
|
||||
isEntity.TakeDamage(damage, owner);
|
||||
currentPierced++;
|
||||
if (currentPierced > pierceAmount)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue