the scarlet police have me at gun point

This commit is contained in:
Sylvia 2026-03-06 02:22:51 -08:00
parent b964c9b617
commit d6da52fd69
54 changed files with 674 additions and 55 deletions

View file

@ -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;

View file

@ -55,7 +55,7 @@ public class Laser : PlayerAbility
enemyList.Remove(enemy);
continue;
}
enemy.TakeDamage(power);
enemy.TakeDamage(power, thisPlayer);
}
currentDebounce = damageDebounceTime;
}

View file

@ -37,7 +37,7 @@ public class NondirectionalLaser : Laser
enemyList.Remove(enemy);
continue;
}
enemy.TakeDamage(power);
enemy.TakeDamage(power, thisPlayer);
}
currentDebounce = damageDebounceTime;
}

View file

@ -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)

View file

@ -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)
{

View file

@ -1,11 +0,0 @@
using UnityEngine;
public class AttackSpeedUpgrade : AbilityUpgrade
{
[SerializeField] private float speedUpgradeAmount;
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade)
{
thisPlayerAbility.cooldown *= speedUpgradeAmount;
}
}

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 8cf716a335ed64e9c9c64a9e934acbd8

View 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...
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e80971b6dc38dd3bf84fc18ed9696f15

View file

@ -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];
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 94cc9fe8fcb5ad3758a0862faf634c2e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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)
{
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c83f7c791d22a8317bdf4351fbcd97a0

View 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);
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d9461c5d5a30726ac8395e724c006d73

View file

@ -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();
}

View file

@ -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;

View file

@ -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)

View file

@ -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();
}

View file

@ -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)
{