BEHOLD, MY SUPER LASER PISS

This commit is contained in:
reisenlol 2026-01-30 02:26:51 -08:00
parent 084aada510
commit e29208a2e5
No known key found for this signature in database
23 changed files with 760 additions and 20 deletions

View file

@ -51,4 +51,8 @@ public class Enemy : Entity
FlipSprite(directionToMove);
}
}
protected override void OnKillEffects()
{
Destroy(gameObject);
}
}

View file

@ -40,7 +40,6 @@ public class Entity : MonoBehaviour
public void TakeDamage(float damage)
{
health -= damage;
health = Mathf.Clamp(health, 0, maxHealth);
if (health < 0)
{
OnKillEffects();

View file

@ -0,0 +1,20 @@
using UnityEngine;
public class FireBullet : PlayerAbility
{
public float accuracy;
public float bulletLifetime;
public float damage;
public float projectileSpeed;
[SerializeField] private Projectile projectile;
protected override void AbilityEffects()
{
Projectile newProjectile = Instantiate(projectile, transform.position, transform.rotation);
newProjectile.damage = damage;
newProjectile.speed = projectileSpeed;
newProjectile.lifetime = bulletLifetime;
newProjectile.RotateToTarget(thisPlayer.mouseWorldPos);
newProjectile.transform.Rotate(0, 0, Random.Range(-accuracy, accuracy));
newProjectile.tag = thisPlayer.tag;
}
}

View file

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

60
Assets/Scripts/Laser.cs Normal file
View file

@ -0,0 +1,60 @@
using System;
using Core.Extensions;
using UnityEngine;
public class Laser : PlayerAbility
{
[Header("Laser Properties")]
public float length;
public float width;
public float duration;
private float currentDuration;
[Header("Beam")]
[SerializeField] private GameObject beamObject;
private GameObject beamObjectInstance;
public float turnSpeed;
public float offset;
private void Start()
{
CreateBeam();
}
protected override void AbilityEffects()
{
canCooldown = false;
currentDuration = duration;
beamObjectInstance.SetActive(true);
transform.Lookat2D(thisPlayer.mouseWorldPos);
}
protected override void 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 (currentDuration <= 0)
{
canCooldown = true;
beamObjectInstance.SetActive(false);
}
}
}
private 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.SetActive(false);
}
private void DetectEnemies()
{
}
}

View file

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

View file

@ -3,6 +3,14 @@ using UnityEngine;
public class Marisa : Entity
{
[Header("Mouse")]
[SerializeField] private Camera cam;
public Vector2 mouseWorldPos;
private void Update()
{
mouseWorldPos = cam.ScreenToWorldPoint(Input.mousePosition);
}
protected override void FixedUpdate()
{
moveDirection = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

View file

@ -1,6 +1,52 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem;
public class MarisaAbilityHandler : MonoBehaviour
{
[SerializeField] private PlayerInput inputHandler;
[SerializeField] private Marisa thisPlayer;
[Header("Abilities")] //maybe have to make them public for when you're changing out abilities
[SerializeField] private PlayerAbility mainAttack;
[SerializeField] private PlayerAbility secondaryAttack;
[SerializeField] private PlayerAbility spellA;
[SerializeField] private PlayerAbility spellB;
[Header("Ability Instances")]
public PlayerAbility mainAttackInstance;
public PlayerAbility secondaryAttackInstance;
public PlayerAbility spellAInstance;
public PlayerAbility spellBInstance;
private void Start()
{
mainAttackInstance = Instantiate(mainAttack, transform);
mainAttackInstance.thisPlayer = thisPlayer;
secondaryAttackInstance = Instantiate(secondaryAttack, transform);
secondaryAttackInstance.thisPlayer = thisPlayer;
spellAInstance = Instantiate(spellA, transform);
spellAInstance.thisPlayer = thisPlayer;
spellBInstance = Instantiate(spellB, transform);
spellBInstance.thisPlayer = thisPlayer;
}
private void Update()
{
if (inputHandler.actions["MainAttack"].inProgress)
{
mainAttackInstance.TryAbility();
}
else if (inputHandler.actions["SecondaryAttack"].inProgress)
{
secondaryAttackInstance.TryAbility();
}
else if (inputHandler.actions["SpellA"].inProgress)
{
spellAInstance.TryAbility();
}
else if (inputHandler.actions["SpellB"].inProgress)
{
spellBInstance.TryAbility();
}
}
}

View file

@ -0,0 +1,16 @@
using UnityEngine;
public class MasterSpark : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View file

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

View file

@ -5,20 +5,22 @@ public class PlayerAbility : MonoBehaviour
{
[Header("Identification")]
public string abilityName;
[Header("Cooldown")]
public Marisa thisPlayer;
[Header("Cooldown")]
public bool canCooldown = true;
public float cooldown;
private float currentCooldown;
public void TryAbility()
{
if (currentCooldown <= 0)
if (currentCooldown <= 0 && canCooldown)
{
currentCooldown = cooldown;
AbilityEffects();
}
}
protected void AbilityEffects()
protected virtual void AbilityEffects()
{
}