1
Fork 0
mirror of https://github.com/Steffo99/beat-td.git synced 2025-02-18 14:53:58 +00:00
beat-td/Assets/Scripts/SnareCollision.cs

25 lines
527 B
C#
Raw Permalink Normal View History

2018-04-23 13:50:24 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SnareCollision : MonoBehaviour {
public int damage;
public float maxRange;
public float speed;
2018-04-23 20:09:13 +02:00
public Vector3 direction = Vector3.down;
2018-04-23 13:50:24 +02:00
private float distance = 0;
private void Update()
{
if(distance >= maxRange)
{
Destroy(gameObject);
}
distance += speed * Time.deltaTime;
2018-04-23 20:09:13 +02:00
transform.Translate(direction * speed * Time.deltaTime);
2018-04-23 13:50:24 +02:00
}
}