movement, automated enemies, automated players, basic abilities

This commit is contained in:
Sylvia 2026-06-09 05:27:47 -07:00
parent 23576e137e
commit f4344c4700
31 changed files with 4343 additions and 70 deletions

View file

@ -0,0 +1,40 @@
using System;
using UnityEngine;
public class Projectile : MonoBehaviour
{
public Entity owner;
public float damage;
public float lifetime;
private int currentPierced;
public int pierceAmount;
public float speed;
[SerializeField] private Rigidbody2D rb;
private void Start()
{
Destroy(gameObject, lifetime);
}
private void FixedUpdate()
{
rb.linearVelocity = transform.right * speed;
}
private void OnTriggerEnter2D(Collider2D other)
{
if (!other.CompareTag(tag) && other.TryGetComponent(out Entity isEntity))
{
isEntity.TakeDamage(damage);
currentPierced++;
if (currentPierced > pierceAmount)
{
Destroy(gameObject);
}
}
else if (other.gameObject.layer == 3) //hard coded layer but who tf cares i'm not inputting the variable every time i make a projectile lol
{
Destroy(gameObject);
}
}
}