mirror of
https://github.com/Steffo99/beat-td.git
synced 2024-11-23 15:54:18 +00:00
24 lines
527 B
C#
24 lines
527 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SnareCollision : MonoBehaviour {
|
|
|
|
public int damage;
|
|
public float maxRange;
|
|
public float speed;
|
|
public Vector3 direction = Vector3.down;
|
|
private float distance = 0;
|
|
|
|
private void Update()
|
|
{
|
|
if(distance >= maxRange)
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
distance += speed * Time.deltaTime;
|
|
transform.Translate(direction * speed * Time.deltaTime);
|
|
}
|
|
|
|
|
|
}
|