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

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