MAAC3601-TD-Game/Assets/Scripts/StandardProjectileController.cs

27 lines
516 B
C#
Raw Normal View History

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StandardProjectileController : MonoBehaviour {
private float speed;
private Rigidbody2D rb;
void Start() {
rb = GetComponent<Rigidbody2D>();
rb.velocity = transform.right * speed ;
}
void Update() {
}
public void setSpeed( float speedIn) {
speed = speedIn;
}
private void OnTriggerEnter2D(Collider2D col) {
Destroy(col.gameObject);
Destroy(gameObject);
}
}