you really gotta calm down, marisa...
This commit is contained in:
parent
13bb58ea03
commit
b9fb490dce
68 changed files with 990 additions and 44 deletions
41
Assets/Scripts/Projectiles/Projectile.cs
Normal file
41
Assets/Scripts/Projectiles/Projectile.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Projectiles/Projectile.cs.meta
Normal file
2
Assets/Scripts/Projectiles/Projectile.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e66b3403d93ec8803822e3a85537224b
|
||||
10
Assets/Scripts/Projectiles/SpinSprite.cs
Normal file
10
Assets/Scripts/Projectiles/SpinSprite.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class SpinSprite : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float rotationSpeed;
|
||||
void Update()
|
||||
{
|
||||
transform.eulerAngles = new Vector3(0, 0, transform.eulerAngles.z + (rotationSpeed * Time.deltaTime));
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Projectiles/SpinSprite.cs.meta
Normal file
2
Assets/Scripts/Projectiles/SpinSprite.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 367cdbe920b6609c2a25c4624980f56a
|
||||
Loading…
Add table
Add a link
Reference in a new issue