basically the whole game

This commit is contained in:
Sylvia 2026-07-09 04:59:48 -07:00
parent 949135cecb
commit 96dcfa9064
315 changed files with 34386 additions and 396 deletions

View file

@ -0,0 +1,13 @@
using UnityEngine;
public class ClearingProjectile : Projectile
{
protected override void OnTriggerEnter2D(Collider2D other)
{
base.OnTriggerEnter2D(other);
if (!other.CompareTag(tag) && other.TryGetComponent(out Projectile isProjectile))
{
Destroy(other.gameObject); //should it destroy or reflect?
}
}
}

View file

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

View file

@ -0,0 +1,42 @@
using System;
using UnityEngine;
public class DelayedAimShot : Projectile
{
[SerializeField] private float aimDelay;
[SerializeField] private float aimedSpeed;
[SerializeField] private float movementDelay;
private Vector3 GetAimedDirection()
{
return (WaveManager.instance.GetRandomPlayerPoint() - transform.position).normalized;
}
private void Update()
{
if (aimDelay > 0)
{
aimDelay -= Time.deltaTime;
if (aimDelay <= 0)
{
speed = aimedSpeed;
if (movementDelay <= 0)
{
direction = GetAimedDirection();
}
else
{
direction = Vector2.zero;
}
}
}
else if (movementDelay > 0)
{
movementDelay -= Time.deltaTime;
if (movementDelay <= 0)
{
direction = GetAimedDirection();
}
}
}
}

View file

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

View file

@ -0,0 +1,21 @@
using System;
using UnityEngine;
public class DisappearingEffect : MonoBehaviour
{
[SerializeField] private SpriteRenderer sprite;
private float currentState;
[SerializeField] private float decaySpeed;
private Color originalColor;
private void Start()
{
originalColor = sprite.color;
}
private void Update()
{
currentState += Time.deltaTime * decaySpeed;
sprite.color = Color.Lerp(originalColor, Color.clear, currentState);
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 825f6d6ee8dd614ca9ad81f57005cad3

View file

@ -0,0 +1,26 @@
using System;
using UnityEngine;
public class ExplosiveProjectile : Projectile
{
[SerializeField] private GameObject explosionEffect;
[SerializeField] private float blastRadius;
[SerializeField] private LayerMask enemyLayer;
protected override void OnTriggerEnter2D(Collider2D other)
{
base.OnTriggerEnter2D(other);
if (!other.CompareTag(tag))
{
GameObject newExplosionEffect = Instantiate(explosionEffect, transform.position, Quaternion.identity);
newExplosionEffect.transform.localScale = new Vector3(blastRadius, blastRadius, blastRadius);
Collider2D[] enemiesInRange = Physics2D.OverlapCircleAll(transform.position, enemyLayer, enemyLayer);
foreach (Collider2D enemy in enemiesInRange)
{
if (enemy.TryGetComponent(out Entity isEntity))
{
isEntity.TakeDamage(damage);
}
}
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9808930a9222595e791e8c290cd7ea9a

View file

@ -3,14 +3,23 @@ using UnityEngine;
public class Projectile : MonoBehaviour
{
[SerializeField] private Rigidbody2D rb;
[Header("Flags")]
public bool deflectable = true;
[SerializeField] private bool isPiercing;
public bool playerBullet; //bad code
[Header("Stats")]
[SerializeField] private int projectileHealth = 2;
public int damage;
public float speed;
public float lifetime;
[Header("CACHE")]
public Vector2 direction;
public AudioClip projectileShootSFX;
public float volume;
[SerializeField] private Rigidbody2D rb;
public SpriteRenderer sprite;
private void Start()
protected virtual void Start()
{
Destroy(gameObject, lifetime);
direction = transform.right;
@ -21,11 +30,27 @@ public class Projectile : MonoBehaviour
rb.linearVelocity = direction * speed;
}
private void OnTriggerEnter2D(Collider2D other)
protected virtual void OnTriggerEnter2D(Collider2D other)
{
if (!other.CompareTag(tag) && other.TryGetComponent(out Entity isEntity))
{
if (playerBullet)
{
GameManager.instance.projectilesHit++; //bad. very bad. but i don't care right now
}
isEntity.TakeDamage(damage);
if (!isPiercing)
{
Destroy(gameObject);
}
}
}
public void Deflected()
{
projectileHealth--;
if (projectileHealth <= 0)
{
Destroy(gameObject);
}
}