you really gotta calm down, marisa...

This commit is contained in:
Sylvia 2026-02-13 00:21:59 -08:00
parent 13bb58ea03
commit b9fb490dce
68 changed files with 990 additions and 44 deletions

View file

@ -0,0 +1,23 @@
using System;
using UnityEngine;
public class BeamCollider : MonoBehaviour
{
public Laser thisLaser;
private void OnTriggerEnter2D(Collider2D other)
{
if (!other.CompareTag(thisLaser.thisPlayer.tag) && other.TryGetComponent(out Entity isEntity))
{
thisLaser.enemyList.Add(isEntity);
}
}
private void OnTriggerExit2D(Collider2D other)
{
if (!other.CompareTag(thisLaser.thisPlayer.tag) && other.TryGetComponent(out Entity isEntity) && thisLaser.enemyList.Contains(isEntity))
{
thisLaser.enemyList.Remove(isEntity);
}
}
}

View file

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

View file

@ -0,0 +1,36 @@
using UnityEngine;
public class FireBullet : PlayerAbility
{
[Header("Projectile Stats")]
public int pierceAmount;
public float accuracy;
public float bulletLifetime;
public float projectileSpeed;
public enum FireMode {Angled, Offset};
[Header("Projectile")]
public FireMode fireMode = FireMode.Offset;
public Vector2 offset;
public float angle;
[SerializeField] private Projectile projectile;
protected override void AbilityEffects()
{
for (int i = 0; i < projectileCount; i++)
{
Projectile newProjectile = Instantiate(projectile, thisPlayer.firingPointBase.position, transform.rotation);
newProjectile.RotateToTarget(thisPlayer.firingPoint.position);
newProjectile.transform.position = thisPlayer.firingPoint.position; //me when i set the position 3 times in a row. but it's to prevent the bullets firing behind marisa
if (fireMode == FireMode.Offset && projectileCount > 1)
{
newProjectile.transform.position += new Vector3(Random.Range(-offset.x, offset.x), Random.Range(-offset.y, offset.y));
}
newProjectile.pierceAmount = pierceAmount;
newProjectile.damage = power;
newProjectile.speed = projectileSpeed;
newProjectile.lifetime = bulletLifetime;
newProjectile.transform.Rotate(0, 0, Random.Range(-accuracy, accuracy));
newProjectile.tag = thisPlayer.tag;
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 62c2c7dce05d07c06b237843ff48ab2e

View file

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using Core.Extensions;
using UnityEngine;
public class Laser : PlayerAbility
{
[Header("Laser Properties")]
public float length;
public float width;
public float duration;
protected float currentDuration;
[Header("Beam")]
[SerializeField] protected BeamCollider beamObject;
private BeamCollider beamObjectInstance;
public float turnSpeed;
public float offset;
[Header("Weapon Properties")]
[HideInInspector] public List<Entity> enemyList = new();
public float damageDebounceTime;
protected float currentDebounce;
private void Start()
{
CreateBeam();
}
protected override void AbilityEffects()
{
canCooldown = false;
currentDuration = duration;
currentDebounce = damageDebounceTime;
beamObjectInstance.gameObject.SetActive(true);
transform.Lookat2D(thisPlayer.mouseWorldPos);
}
protected override void Update()
{
base.Update();
if (currentDuration > 0)
{
Vector3 direction = (thisPlayer.mouseWorldPos - (Vector2)transform.position).normalized;
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.RotateTowards(beamObjectInstance.transform.rotation, Quaternion.Euler(0,0,angle), turnSpeed * Time.deltaTime);
currentDuration -= Time.deltaTime;
if (currentDebounce > 0)
{
currentDebounce -= Time.deltaTime;
if (currentDebounce <= 0)
{
foreach (Entity enemy in enemyList.ToArray())
{
if (!enemy)
{
enemyList.Remove(enemy);
continue;
}
enemy.TakeDamage(power);
}
currentDebounce = damageDebounceTime;
}
}
if (currentDuration <= 0)
{
canCooldown = true;
beamObjectInstance.gameObject.SetActive(false);
}
}
}
protected virtual void CreateBeam()
{
beamObjectInstance = Instantiate(beamObject, transform.position, Quaternion.identity);
beamObjectInstance.transform.SetParent(transform);
beamObjectInstance.transform.localScale = new Vector3(length, width, 1);
beamObjectInstance.transform.Translate(Vector3.right * (beamObjectInstance.transform.localScale.x * 0.5f) + new Vector3(offset, 0, 0));
beamObjectInstance.thisLaser = this;
beamObjectInstance.gameObject.SetActive(false);
}
//maybe we should've made this a projectile instead of an ability lol
//its ok we can work with this still
}

View file

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

View file

@ -0,0 +1,66 @@
using System.Collections.Generic;
using UnityEngine;
public class NondirectionalLaser : Laser
{
[SerializeField] private int beamCount = 1;
[SerializeField] private Transform beamRoot;
private List<BeamCollider> beamInstances = new();
protected override void AbilityEffects()
{
canCooldown = false;
currentDuration = duration;
currentDebounce = damageDebounceTime;
beamRoot.gameObject.SetActive(true);
}
protected override void Update()
{
//we're doing this the stupid way i guess because i am stupid
if (currentCooldown > 0)
{
currentCooldown -= Time.deltaTime;
}
if (currentDuration > 0)
{
// i think i can just put spinobject in it and that'll work lol
if (currentDebounce > 0)
{
currentDebounce -= Time.deltaTime;
if (currentDebounce <= 0)
{
foreach (Entity enemy in enemyList.ToArray())
{
if (!enemy)
{
enemyList.Remove(enemy);
continue;
}
enemy.TakeDamage(power);
}
currentDebounce = damageDebounceTime;
}
}
if (currentDuration <= 0)
{
canCooldown = true;
beamRoot.gameObject.SetActive(false);
}
}
}
protected override void CreateBeam()
{
float rotationAmount = 360f / beamCount;
for (int i = 0; i < beamCount; i++)
{
BeamCollider newBeamObjectInstance = Instantiate(beamObject, transform.position, Quaternion.identity);
beamInstances.Add(newBeamObjectInstance);
newBeamObjectInstance.transform.SetParent(beamRoot);
newBeamObjectInstance.transform.localScale = new Vector3(length, width, 1);
newBeamObjectInstance.transform.Translate(Vector3.right * (newBeamObjectInstance.transform.localScale.x * 0.5f) + new Vector3(offset, 0, 0));
newBeamObjectInstance.transform.RotateAround(beamRoot.position, Vector3.forward, rotationAmount * i);
newBeamObjectInstance.thisLaser = this;
}
beamRoot.gameObject.SetActive(false);
}
}

View file

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

View file

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAbility : MonoBehaviour
{
[Header("Identification")]
public string abilityName;
public Sprite abilityIcon;
public Marisa thisPlayer;
[Header("Cooldown")]
public bool canCooldown = true;
public float cooldown;
protected float currentCooldown;
[Header("Stats")]
public float power;
public float projectileCount;
public HashSet<AbilityUpgrade> attachedUpgrades = new();
public void TryAbility()
{
if (currentCooldown <= 0 && canCooldown)
{
currentCooldown = cooldown;
AbilityEffects();
}
}
protected virtual void AbilityEffects()
{
}
protected virtual void Update()
{
if (currentCooldown > 0)
{
currentCooldown -= Time.deltaTime;
}
}
}

View file

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