you really gotta calm down, marisa...
This commit is contained in:
parent
13bb58ea03
commit
b9fb490dce
68 changed files with 990 additions and 44 deletions
|
|
@ -1,41 +0,0 @@
|
|||
using System;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class Projectile : MonoBehaviour
|
||||
{
|
||||
public float damage;
|
||||
public float speed;
|
||||
private int currentPierced;
|
||||
public int pierceAmount;
|
||||
public float lifetime;
|
||||
[SerializeField] private Rigidbody2D rb;
|
||||
|
||||
public void RotateToTarget(Vector3 target)
|
||||
{
|
||||
transform.Lookat2D(target);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue